Submitting Xml Documents to BizTalk via SOAP

This sample shows how to modify a BizTalk Web Service to submit Xml Documents into BizTalk and route them using direct binding. The key to routing the message submitted by the Web Service is to make sure the Receive Port uses the Xml Disassembler pipeline.

This sample will work with BizTalk 2006 and BizTalk 2006 R2.

Get more information from the original blog post on this topic: and

Working With Untyped Web Services in BizTalk Server

Creating an Untyped Web Service will allow you to easily submit Xml Documents into BizTalk through the web service.  Make sure you check out my previous post on this topic.


Create the Web Service

1. Run the Web Service Publishing Wizard

2. Select “Publish Schema as A Web Service”

3. Delete “WebService1”

4. Right-Click on BizTalkWebServce, select Add Web Service

5. Right-Click on WebService1, select Add web method, One-Way

6. Right-Click on Request, select Schema Type 

7. Select any dll with a schema, select any schema

8. Select next and fill out any other required information

9. Make sure you select Create Receive Port otherwise you’ll have to do this manual

Edit the Web Service

1. Open the newly created web service

2. Edit the web method signature to look like this:

     public void WebMethod1(System.Xml.XmlDocument part)

3. Look for the inParms line it should look like this:

Microsoft.BizTalk.WebServices.ServerProxy.ParamInfo[] inParamInfos       

4. Change the TypeOf to be System.Xml.XmlDocument

These same steps should work for BizTalk 2004 as well.

How To Use SOAP to Submitt Xml Documents Into BizTalk Server

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.