Using Variable Mapping in a WCF-WebHttp Send Port without using promoted properties

When you call a REST Service in BizTalk 2013, there could be scenarios when an ID, or any other query variable, must be determined at runtime. To enable such scenarios, you specify variables for the HTTP Method URL Mapping. The variable maps normally to a promoted field in a message but there are some scenarios where you cannot use promoted properties.

In this sample I’m going to call a REST Service and update an Event for a specific Customer with BizTalk. To start the process I receive a CustomerEvent message with a Customer Id. Because the REST service expects a data message I have to transform it to the data message and post the data message to the REST service.

SoapUI POST method





REST Service called by SoapUI

But also the Customer Id needs to be dynamically set in the URI at runtime. I can’t use property promotion to dynamically set the URI because I don’t have a customer_id field in the data message. So in this specific case I cannot use promoted properties.
To solve this I’m going to put the customer_id field from the CustomerEvent message in a custom context property because I don’t have the customer_id field anymore in the data message.


The following steps show how you can use variable mapping and context properties without using promoted properties.

Generate schemas for the CustomerEvent- and the data message.
Generate Schema
Create a Property schema.
Add Property Schema
In the Property Schema Base property you can specify if the property is a Message Data property or a Message Context property.
Create a BizTalk Map to transform the CustomerEvent message to the data message.
BizTalk Map
Create an Orchestration to execute the Map and set the custom context property in a Message Assignment shape. (The customer_id is a distinguished field and is not promoted.)
Set ContextProperty

Create a Send Port in the BizTalk Administration Console. Specify WCF-WebHttp for the Type option in the Transport section of the General tab.
Also specify variables for the HTTP Method URL Mapping, provide the variable component of the URL within curly brackets { }.

WCF-WebHttp Transport Properties
Click in the Variable Mapping section on the ‘Edit…’ button to specify where the value for the variable ID must be picked from at runtime. Under the Variable column, the dialog box lists the variables that you defined for the URL Mapping. In the Property Name field you must specify the name of the property that provides the value to be associated to the variable.
Variable Mapping



If you have to call a REST Service with BizTalk and the URI has to be dynamically set at runtime, you normally can use property promotion. However there are scenarios where you cannot use promoted properties and in such cases custom context properties are a really good alternative!

You can download the BizTalk sample with the source code here:

About the author

Tomasso Groenendijk lives in Netherlands and is a senior integration consultant at Motion10. He has over 15 years’ experience in software development and software design. Tomasso is specialized in application integration with a strong interest in the Windows Azure cloud platform. In 2014, 2015 and 2016 Tomasso was awarded with the Microsoft Azure MVP award. He is an active contributor to the integration community through his work on his blog, MSDN samples, TechNet Wiki and also speaking on events.

MVP profile Tomasso Groenendijk
Sentinet Product Specialist
BizTalk360 Product Specialist

Month List