Calling Restful Services using Itinerary in BizTalk 2013

Posted: November 12, 2013  |  Categories: ESB Uncategorized

In the previous post, I showed how to call Restful services using dynamic send ports.

In this post, I am going to leverage that concept to make a Rest Service call using Itinerary.

1. In order to call a restful service using dynamic send port, three main context values should be available in the message. These are
• VariablePropertyMapping
• HttpMethodAndUrl
• SuppressMessageBodyForHttpVerbs

2. These values can’t be promoted using any out of box components in Itinerary. Hence I created a custom pipeline component, that promotes these three values to context. I am using this custom component on my Receive Side -> Decode Stage.

On the high level, below is how the pipeline component code will be.
1

3. I created a Receive pipeline with my custom pipeline component (to promote the 3 main values) + ESB Components to select the itinerary & dispatcher.

2

When I applied this pipeline, my required fields for Restful call & ESB itinerary will be available in the context of the message before it is published to the message box.
4. I started working on creating an itinerary. But Itinerary routing resolver doesn’t provide WebHttp Transport Name.

3

Hence I started creating a Custom Adapter Provider extending from “WCFBaseAdapterProvider”. Below are the contents of the class.

4

I then Gac’ed the assembly and added the details of this transport name in esb.config file. (It will be C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.2\esb.config)

Under Adapter providers, I added the new dll details like below.
5

5. After the above changes to esb.config file, I am able to see WebHttp Transport type.

6

6. I created a simple Itinerary like below.

7

For the static Resolver, below is how I set the Url & Transport type.

8

7. Quick Summary:
• I used a custom pipeline component to promote my required operation & variable mapping on the Receive Pipeline.
• Since, I don’t see WebHttp transport name, I created a custom adapter type & updated esb.config file.
• I used a static Resolver & Provided Transport Location & Transport Name.
8. That’s it. I am done. Once a message is received, my custom pipeline component will write the operation & variable mapping to context. ESB itinerary will be loaded. Itinerary will set the Transport Type as WCF-WebHttp & Transport url to the configured value. This message is then submitted to a Dynamic Send Port. Response from dynamic Send Port is routed back to the Request Response Receive port.

I am not sure if this is a perfect way of doing. But it solved my problem.

HTH
– Shiv

#1 all-in-one platform for Microsoft BizTalk Server management and monitoring
turbo360

Back to Top