Jon Flanders' Blog

Another BizTalk code sample/utility

Tuesday, March 15, 2005 8:00:00 AM (GMT Standard Time, UTC+00:00)

Here's another code sample. This one I wrote quite awhile ago and just hadn't gotten around to posting it. When working in BizTalk - one of the most important pieces of information floating around is the Message Context. The Message Context is essentially a set of name/value pairs (qualified by a schema namespace URI) that follow messages around as they flow between Receive Ports and the MessageBox, from the MessageBox to Orchestrations, from the MessageBox to Send Ports (you get the idea - messages don't go anywhere without their corresponding context).

The Context is almost always used by the subscription services in the MessageBox to figure out where a particular message is supposed to be routed. Often times the Context property "MessageType" is used (especially with Orchestration subscriptions this is often the case).

Most of what Receive Pipelines do is promote or add properties into the context (only promoted properties are used for subscriptions services however). Other components use Context properties as well, for example the HTTP Send Adapter will send a SOAPAction HTTP Header if there is a value for the SOAPAction Context Property in the message it is processing (this is if you want to use the HTTP Adapter in the raw to send SOAP messages to a Web Service).

The code sample - which I call the Context Adder pipeline component (which you can download here (full source) is a component you can place in any stage of either a Receive or Send pipeline, and you can configure it with a collection of Context properties (simple written properties or promoted properties). The component will just blindly put whatever values you configure it with into the context. This is just useful as a generic way to add properties into the Message Context when needed (and it is needed pretty often - at least I need it pretty often).

  #    Comments [6]   

Friday, March 18, 2005 3:21:18 PM (GMT Standard Time, UTC+00:00)
Great tool. This very simple pc comes in useful for every BizTalker. Please recheck the persistence of the 'promote' boolean again because this isn't working the way it should. At least my copy isn't... I would also recommend to use it only for the 'All' stages of the pipeline (not the 'First Match' stages, I guess it will not work in the dissamble stage anyway). Nice job.
Sunday, January 29, 2006 6:32:22 PM (GMT Standard Time, UTC+00:00)
hi, I want to use these context properties in a port filter.
You know like doing it, because these properties not are in the filter's dropdown list ?

thanks and sorry by my english
Sunday, January 29, 2006 6:51:48 PM (GMT Standard Time, UTC+00:00)
You need to deploy the Property schema you created with BizTalk to see these in the Filter dropdown list.
Friday, February 10, 2006 10:10:02 PM (GMT Standard Time, UTC+00:00)
Great tool... Is it possible to access the message context from inside a map using a C# functoid?
Friday, February 10, 2006 10:13:09 PM (GMT Standard Time, UTC+00:00)
No - the message inside of a map has been transformed into just plain XmlDocument.
Friday, March 03, 2006 12:14:14 PM (GMT Standard Time, UTC+00:00)
Hi John,
Nice tool! I'm kinda new to biztalk so I wondered how I could use your tool to achieve the following scenario: I have a message which consists out of two parts. These parts are achieved bij processing an email which has 2 attachments. I want to promote the filenames of the attachments for later use in my orchestration and sendports. How can this be done. I would appreciate any feedback on this issue. Thanks in advance
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Navigation

Books

Courses

Search

Subscribe

  • RSS 2.0
  • Add to Windows Live button
  • Add to Google button
  • Add to MyMSN button
  • Add to MyYahoo button
  • Add to Bloglines button
  • Add to Newsgator button