Many times we have face a situation when we want to see the response received from a 2-way send port (request- response) after calling a web-service, performing some database operation etc. using two way send port. Normally such a scenario arises during testing phase.
There are multiple ways to subscribe to the response message received from the 2-way send port but the easiest option is explained below.
Benefits of below implementation:-
- It doesn’t requires any code change
- It doesn’t affects the original flow of the application
How to do it :-
Just create a Send Port with Filter Condition as
BTS.SPName = <Name of the 2-way Send Port>
How does it works:-
Whenever a two way send port publishes the response back to message box, it promotes two properties
- SPName: – This context property holds the name of the Send Port which has published this message to MsgBox. We are exploiting this property only.
Context Properties of Response Message Image
- Correlation Token: – For a two way send port End Point Manager (EPM) creates Instance subscription for receive shape with subscription for Correlation Token.
In BizTalk we have two subscriptions – Activation and Instance.
Activation Subscription: – A new instance of the subscriber is created when a message is received. For example first receive shape in Orchestration with “Activate = True”.
Instance Subscription: – Incoming message is routed to an already-running instance of the subscriber. Unique instance ID is stored in the subscription table in the master Message Box.
For example correlated receive in Sequential or Parallel Convoys or in two way send port.
I have created a sample application which consumes a simple “Hello World WCF Service”.
Download the sample application here.
Don’t forget to edit the binding files before running the test.
Get the MSWord version of this blog from here.
@Gmail, @Facebook , @Twitter, @LinkedIn , @MSDNTechnet, @My Personal Blog