BizTalk Server Tutorial

BizTalk Server Concepts and Common Errors

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&#8217; xmlns:xsd=’http://www.w3.org/2001/XMLSchema’&gt;

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

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

</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.

HTH
– Shiv

November 11, 2013 - Posted by | Adapters | , , ,

2 Comments »

  1. Exactly what I was looking for. Thanks a ton🙂

    Comment by Praveen Behara | May 21, 2015 | Reply

  2. […] the previous post, I showed how to call Restful services using dynamic send […]

    Pingback by Calling Restful Services using Itinerary in BizTalk 2013 « BizTalk Server Tutorial | November 12, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: