This is a follow up from the previous post Part 1: ESB ToolKit Itineraries. In this post, I will extend the previous one way Itinerary and expose it as a two way service. Below is the scenario.
Rcv Msg -> Transform it into external WCF Service Call -> Call external service -> Send Response back to caller
1. Create a copy of existing Itinerary. (This is in continuation from previous post)
2. Rename the file to “TwoWayTransformService” and change the Name property as well.
3. Create a sample WCF Service to receive a message and send a response.
4. Consume the Service in a BizTalk Project & Create a BizTalk map to convert a Sample Request message into WCF Service Call.
5. Change IsRequest Response to True in the below locations.
a. Itinerary – > See #2 screenshot
b. All the Itinerary Service Components
6. Create a two way Dynamic Send Port with Pass through pipelines & set filter as below.
7. In the OffRamp, update the Send Port with the newly created two way port.
8. Remove the link between OffRamp & Publish and reconnect that. Make sure that Publish is showing the new Filter properties. Sometimes you will have to remove the component and recreate it.
9. Update the Resolver in Route Component to point to Web Service created above.
You can use the WSDL of the service to fill it.
10. Validate and export the Itinerary.
11. Now expose the Request Message and WCF Response Message as a Service using BizTalk Service Publish Wizard.
12. Wizard will create the Receive Port & Location. Change the Receive pipeline to “Itinerary Rcv” which is the custom pipeline created in previous post. Change the Itinerary Name in Resolver Connection String.
13. Make sure that WCF Service is working fine by enabling the Receive Location.
14. Now create a soap UI project and make a test. You should see the response.
Note: In the above Itinerary, there are no Itinerary related components in OffRamp Send handler / OffRamp Receive Handler.
Incase if you are using any components in the OffRamp Send handler / OffRamp Receive Handler then you should create two custom pipelines
1. Send Pipeline with ESB Dispatcher (Encode) & ESB Itinerary Cache (Encode) to be used in Two way Dynamic Send Port (instead of Pass through)
2. Receive Pipeline with ESB Itinerary Cache (Decode) & ESB Dispatcher (Resolve Party)
This is required because, when message goes out of BizTalk, ESB caches the Itinerary associated with the message before sending the message out and loads it back from cache after receiving the response from external system.
ESB uses “TransmitWorkID” context property for this.
Hope this helps.