Map Request to Response in BizTalk Server

Consider the following scenario:
  • You need to receive a message into BizTalk Server, and send an acknowledgement back to the sender (probably using a Request-Response port).
  • The response is trivial, it’s similar to a void response in WCF, or containing only information that can be obtained from the request message (such as an ID or something).
The figure below displays this scenario graphically:
BizTalk Server doesn’t allow that easily out of the box, because there’s no standard way to create a response and correlate it to the request without involving an orchestration or a solicit-response port.
In comes the context property RouteDirectToTP. If you set this property on the inbound request with value true, the BizTalk Messaging Engine will route the request immediately back to the receive port (actually, it routes it back to any instance subscription with the matching EpmRRCorrelationToken. This post explains why. In the above scenario, the receive port has such an instance subscription). Since the receive port has an outbound map, that transforms the request to response, the sender will receive the response message.
In the above sample, the context property is set using a ContextManipulator pipeline component, which can manipulate context properties based on xml configuration. This xml configuration looks like this:
<cmc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <cm xsi:type="add">
    <cpi>
      <name>RouteDirectToTP</name>
      <namespace>http://schemas.microsoft.com/BizTalk/2003/system-properties</namespace>
      <value>True</value>
      <type>Boolean</type>
      <promoted>true</promoted>
    </cpi>
  </cm>
</cmc>

The ContextManipulator pipeline component allows to add, remove, map, change, promote and demote context properties.

Below a screenshot of using the WCF Test Client to receive a response using the above sample:

WCFTestClient

You can download the sample from my skydrive. It includes the sources for the ContextManipulator pipeline component.

Advertisements

About Bram Veldhoen

I'm an independant senior software development consultant, working mostly in the area of integration using Microsoft BizTalk Server, Windows Communication Foundation and .NET.
This entry was posted in BizTalk and tagged , , , , , . Bookmark the permalink.

One Response to Map Request to Response in BizTalk Server

  1. Johann says:

    This is brilliant, very helpful for those cases where you don’t want to muddy up your orchestration with handling of responses which might only be used on certain types of adapters. Thanks for that Bram, I’ll be sure to use this someday.

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s