BizTalk Server 2004 makes it fairly easy to consume Web Services from orchestrations through the use of the SOAP Adapter and the ubiquitous Add Web Reference wizard it supports. Usually, when you consume a WebService, the Add Web Reference wizard will create a set of multi-part message types (although called a Web Message Type), one for each input and output message from the service operations.

For Document/Literal services, this works out perfectly, because the generate message types contain only a single part (it maps cleanly to the WSDL definition of the message), making it very easy to manipulate request and response messages for the webservice using the standard BizTalk tools. You can even manipulate the generated schemas to, for example, mark elements and attributes in them as Distinguished fields.

However, BizTalk Server can also consume RPC/Encoded Web Services just as well. However, if you have to work with them, you should be aware of how the message types are generated so you know what tools you'll be able to use. As usual, the Add Web Reference Wizard will create multi-part message types for input and output messages from the service's operations. The key difference, though, is that these will actually have multiple parts; one for each argument in the operation signature (for input messages, or for out parameters for output messages).

This is important because now you have to manipulate the messages manually, using Expression Shapes in your orchestrations. Using tools like maps is out of the question because you can't directly manipulate the entire message as a single unit (since it is multi-part).

Another common scenario with RPC/Encoded services is that at least one of the parameters to an operation is a string type used to carry an encoded XML fragment. To manipulate those, you'll want to manually define schemas for the fragments, and then load them at runtime into separate messages using an intermediate XmlDocument instance (there are many examples of this out there, so I won't cover it in more detail here). If you need to assign a value to one of these parameters, you'll probably want to use a simple component that can extract a string from a regular BizTalk message you can assign to it (you can certainly manipulate them directly as strings, but that might be harder).

While all of this might not be a big deal in the end, it might be wise to remember this because depending on the complexity of your mappings, this can mean doing a lot of work manually using components and expression shapes to do custom mapping and transformations and message assignment, so it can change how you estimate the effort necessary for your project.


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.