When working with Web Services, the common scenario is to pass in the credential in the SOAP Header.
In this post, I will provide the steps how to do this in BizTalk Orchestration.
This will be a simple flow like below screen shot :
Flow Detail :
- Web Application will call an exposed web services by Biztalk Orchestration
- The request object consists of 3 elements : UserName, Password, Message
- BizTalk Orchestration will construct the SOAP Header Message with UserName and Password
- BizTalk Orchestration will assign the Message as the body and assign the SOAP Header
- BizTalk Orchestration calls the Web Services (WSSOAPHeader)
- Web Services will read the SOAP Header message and return back some message
- BizTalk will also return back the message to the web application
One of the most crucial thing in here is the SOAP Header message.
To create the SOAP Header message schema :
- Create a property schema file
- In the schema properties, change the Target Namespace to http://schemas.microsoft.com/BizTalk/2003/SOAPHeader Set the Node Name property to the SOAP Header Name and the Property Schema Base to MessageContextPropertyBase
varXMLSOAPHeader = msgSOAPHeader;
msgWSRequest(MyBizTalkApp.AuthenticationSOAPHeader) = varXMLSOAPHeader.OuterXml;
- When assigning the SOAP Header, it expects string value, that's why I assign the msgSOAPHeader into an XML document variable and get the string from OuterXml property.
- If the SOAP Header is not received by the web services even though you have assigned it in the code, make sure that you have followed each of the steps to create the SOAP Header message schema above, especially the namespace part. It caused me 2 days to notice this one in the end :P
Here is the link to the MSDN Site : Consuming Web Services with SOAP Headers
Hope this helps