Sometimes when developing orchestrations in BizTalk it can be useful to be able to communicate with web services. For this example I’ll be calling a web service to generate a MIN for a loan based on the organizationID and sequence number that are passed in as parameters. Below is the definition for the web method:

The incoming message that activates the orchestration will contain the organizationID and the sequence number. An example of the input message is provided below.
.PNG)
To communicate with the web service, we’ll need to add a web reference to the project that contains the MINGenerator web service.

If the method includes something other than primitive data types, there will also be a Reference.xsd file under Reference.map. After adding this reference, we’ll be able to create messages to communicate with the web service defining the type as a Web Message and choosing the appropriate schema.

These values will be used to create the request message that is passed into the web service.
When working with this type of message, all of the values within the message are considered to be distinguished and you have to create the message within a Message Assignment shape – you can’t define a Transform to create the message because you can’t select the desired schema as a destination schema.
To define a port to communicate with the web service, you’ll need to create a configured port within the orchestration. Be sure to select the existing Port Type option and find the appropriate definition under Web Port Type.

Below is a screenshot of the orchestration.

We first receive a MIN request, create a MINGeneratorRequest using the values from the initial request, and communicate with the web service. We receive a response from the web service that contains the new MIN and use this value to create a new message
Source code for this example can be found here.