How to Subscribe the Response Message of 2-Way (Request- Response) Send Port

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

  1. It doesn’t requires any code change
  2. 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>

Filter Condition on Send Port - > BTS.SPName = <Name of the 2-way Send Port>

Filter On Send Port Image

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 Property of the Response Message PublishedContext 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.

Contact Me:- 

@Gmail@Facebook , @Twitter, @LinkedIn @MSDNTechnet, @My Personal Blog 


8 thoughts on “How to Subscribe the Response Message of 2-Way (Request- Response) Send Port”

    1. Yes Piort, definitely you will have to create a send port with Subcription as below –
      BTS.SPName = {GUID of the 2 way SP configured as specify later. i.e. SP which calls WS}
      For getting the GUID of the SP, go to the Admin console -> Subscriptions -> find your SP -> double click and check the subscription filter it will be something like below.
      SPID = {GUID}

      Also, a simple way would be stop the SP(not unenlist) this will suspend the SP and there you can view the message which was going to the web service.
      Hope it helps.


  1. Hi Prashant,

    What if the send port have a custom pipeline in the response and there is a error while processing the pipeline , is there a way to get the message which is feed into the pipeline?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s