Thursday, 15 January 2009

How to send Custom Soap Headers from BizTalk

Hi, I have been searching for an good article which shows the step by step development approach for sending a Custom Soap Headers from Biztalk. I found a couple of Microsoft blogs but its not very clear to me.

I just started my invention to find the right direction to accomplish this task today. I thought this would a help others to work with custom soap adapters.

The first Step is to develop an Webservice which had an additional SOAP header to the Webmethod. I hope you are expert in writing .net code to build an simple Webmethod.Here is my sample WebMethod and custom Soap header.

Now lets start work on Biztalk Part

First Step is to create a Similar Soap Header Property Schema at biztalk and set the couple of property to make use of Custom Soap header. How you are going to achieve this?
Add webreference to your Biztalk Application. You can find the Reference.XSD Schema with custSoap header.

Steps to Create Soap Header Schema:
Create a Property Schema and rename to any(not necessary to rename) Just to keep this schema as more understandable. I renamed it as SoapHeader.xsd
Rename the “Property1” element to your Custom soap Header Class name and set the properties as mentioned below.
Ex: In my above .net Code my Soap header class name is “CustAuthHeader
Schema property:
CustAuthHeader Property :
PropertySchemaBase = MessageContextPropertyBase

Assign SoapHeader Property values at Orchestration level :
As soon as you add web reference you can find Reference.xsd file which contain the SoapHeader elements. Here you have 2 options
  1. You can use Reference.XSD schema to send the UserName, Password
If you don’t find Reference.xsd then Create your Own schema and maintain Rootnode same as SoapHeader Class name and Input params as Elements.

Here I am using Reference.xsd schema to test this sample.
Before you call webMethod you need to pass the Soap Headers to the WebService Request. The orchestration Steps are

  1. collect the Input values from the Inbound Schema
  2. map the InputSchema to Reference.xsd Schema
  3. Assign Reference Schema Values to SoapHeader Property
  4. Call Webservice and get Response

Here step1, 2 and 4 is easy. What about the step 3 ? what you need to write at Assignment Shape ?
Here is the code
vxmlObj = new System.Xml.XmlDocument();
vxmlObj= WsReferenceMsg;
Note: SOAPHeaderTest.CustAuthHeaderĂ  ProjectName.YourPropertySchemaRoot element.

Your final Orchestration should look like above image.
You can reach me at :


  1. Hi Raj,

    Can you please upload the sample project for this?
    I am trying to implement the similar functionality, however I am facing issues.


    1. Have you got the Sample Project ? if yes can you reply here

    2. Unfortunately I do not have a sample project for this article. Instead you can follow the article and prepare one at your end.