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. In the Construct_GetRequest, I used the below code:

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


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



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

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

<BtsVariablePropertyMapping xmlns:xsi=’’ xmlns:xsd=’’>

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

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


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.


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
  • Pingback: Calling Restful Services using Itinerary in BizTalk 2013 « BizTalk Server Tutorial()

  • Praveen Behara

    Exactly what I was looking for. Thanks a ton 🙂

  • Maithili Kotla

    Hi, very useful article. I am trying to use the same logic to send a POST message with a JSON payload to a rest service using dynamic WCF-WEBHTTP send port and I keep getting “System.Xml.XmlException: Data at the root level is invalid. Line 1, position”

    • Create and assign the dynamic send port pipeline to one that encodes/serializes your output as JSON using the JSON Encoder pipeline component, otherwise your pipeline may default to XmlTransmit.


BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More

Manage and monitor serverless
components effortlessly

Learn More
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top