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