You probably know about untyped messages inside an Orchestration (that is, messages treated as Xml Documents rather than typed schema). Wouldn’t it be nice to have an untyped web service to submit messages into BizTalk?

How would this make life easier?

You could have one web service to receive all your different message types. Then, use direct binding and content based routing to get your messages to the correct destination.

This will not work for all scenarios. But, it can greatly increase your flexibility when submitting messages into BizTalk through a web service by allowing all external systems to call the same web service.

Download the sample code below that shows how easy it is to modify an existing BizTalk Web Service to accept Xml Documents rather than a typed message. The key to routing the message submitted by the Web Service is to make sure the Receive Port uses the Xml Disassembler pipeline. This will promote the message type property that can be used for routing.

As with any direct binding solution, extra care must be used to make sure you do not get into an endless loop. In the sample below, I use Message Type and Receive Port Name Exists to make sure only messages published by a receive port are routed to the Orchestration.

Download: Xml Documents to BizTalk via SOAP Sample

This sample was built using BizTalk 2006 using Visual Studios 2005. See the ReadMe.txt for set up information.