Calling Restful Service using Dynamic Send Ports – BizTalk 2013

Posted: November 11, 2013  |  Categories: Adapters Uncategorized
You can download the entire article as a PDF document.
Calling Restful Service using Dynamic Send Ports – BizTalk 2013

There are a number of wonderful blog posts on calling Restful Services using Out-Of-Box BizTalk WebHttp Adapter in BizTalk 2013.

But all of the blog posts deals with static send ports. However, I had a very different situation where in I have to make a RestCall using dynamic send port (to be used with ESB Itineraries).

The only difference in making a call using dynamic send ports is that, all the configuration that we do in static send port has to be in context. I started analyzing the context properties for WCF Adapter and found 3 main properties that are required for making a RestCall using dynamic Send Port.

  1. VariablePropertyMapping
  2. HttpMethodAndUrl
  3. SuppressMessageBodyForHttpVerbs

To start with I created a simple orchestration that receives a message, constructs a copy of that message with additional context properties.

1

1. In the Construct_GetRequest, I used the below code:
2

• Basically, I am taking the same received message and assigned additional context properties.
• For WCF.HttpMethodAndUrl, an xml has to be assigned in the below format. This is the same xml that we specify under “HTTP Method and URL Mapping” in case of a Static Send Port.

<BtsHttpUrlMapping>

  <Operation Name=’RestGET’ Method=’GET’ Url=’/GetEmp/{EmpId}/{State}’ />

</BtsHttpUrlMapping>

3

• For WCF.VariablePropertyMapping, an xml has to be assigned in the below format.

<?xml version=’1.0′ encoding=’utf-16′?>

<BtsVariablePropertyMapping xmlns:xsi=’http://www.w3.org/2001/XMLSchema-instance’ xmlns:xsd=’http://www.w3.org/2001/XMLSchema’>

<Variable Name=’EmpId’ PropertyName=’EmpId’ PropertyNamespace=”https://MySoln.PropertySchema” />

<Variable Name=’State’ PropertyName=’State’ PropertyNamespace=”https://MySoln.PropertySchema” />

</BtsVariablePropertyMapping>

This is the XML format of Variable Mapping that we do in case of a static send port.

• For WCF.SuppressMessageBodyForHttpVerbs, specify a value of “Get”
2. In the Initialize Dynamic Send Port Shape of the Orchestration, I am assigning the Transport type & URL.

4

3. Once we deploy this Orchestration, it will automatically create a physical dynamic send port in admin console & bind the logical port of the orchestration to the physical port.

Setting the three context properties is the main key for using dynamic send port for Restful service calls. These three properties can also be set in a custom pipeline component. However, I created an orchestration to make my demonstration easier.

You can download the entire article as a PDF document.
Calling Restful Service using Dynamic Send Ports – BizTalk 2013
#1 all-in-one platform for Microsoft BizTalk Server management and monitoring
turbo360

Back to Top