How to call RESTFULL service using Dynamic Ports with Variable Mapping in WCF-WebHttp Adapter

The following TechNet article describes on how to call a RESTFull Service from WCF-WebHttp Adapter in BizTalk 2013.

 However, in this blog, we will discuss how to implement the same solution using Dynamic Send Ports and receiving the response in BizTalk Server. 

The application works as follows:
We receive an incoming message containing the name of the Airport Code for which we want to receive the weather conditions. Then we create a binding in the orchestration for the dynamic send port to call the RESTFull service:<AirPortCode>?format=xml
The details of the service can be found at:
The response will be received back in the application and send back to the File location. 

Here is the step by step description on how to achieve this:

1. Create a new application and create a following schema:

Now do a Quick Promotion for the AirportCode.This will allow Visual Studio to add the property schema. In the Property Schema, Delete the Property1 node.

2. In the orchestration, after the receive shape create a construct shape and add the following code:
/*Creating a new output message */
   output = input;                                       
   output(*)= input(*); 

/*this part of the code defines how to set the variable mapping. The APC variable will contain the promoted property value. */
   output(WCF.VariablePropertyMapping)= @"<?xml version='1.0' encoding='utf-16'?>
   <BtsVariablePropertyMapping xmlns:xsi='' xmlns:xsd=''>
   <Variable Name='APC' PropertyName='AirportCode' PropertyNamespace='https://TestDynamicPort.PropertySchema' />

/*Next we define the Outbound Message Property as in the Messages Tab in the send port */

/*Define transport properties */

/*Here we define the Action as we define in the General tab. Here my port is names as Port_2*/
   output(WCF.HttpMethodAndUrl)=@"<BtsHttpUrlMapping> <Operation Method='GET' Url='status/{APC}?format=xml' /></BtsHttpUrlMapping>"; 


3. Now create a Request-Response port and specify as: 

 4. At this point the orchestration should look something like this:

5. Deploy the application.

6. Next create a physical receive location to receive the input message :
    <ns0:AirportStatusRequest xmlns:ns0="http://TestDynamicPort.AirportStatusRequest">

 7. Create a send port to send the response message to a physical location.

You should now be able to consume a RESTFull Service in BizTalk Server using Dynamic Send ports to create bindings.

Hope this helps.. !!!

Written By
Rasika Chaudhary

Reviewed BY
Jainath Ramanathan

Microsoft GTSC 

Comments (1)

  1. vishal says:


    I have wcf-webhttp adapter for request and response. in request i am sending xml as json(jsonpipeline is converting ) but in the response i am getting msg as {“Message”:”Failed”,”Content”:null,”Status”:false} . I have configured webhttp adapter for post operation but still i am not getting successfull message.

Skip to main content