Accessing SOAP Headers in WCF Messages with Pipeline Components
To access the SOAP headers with the WCF adapters in pipeline components, you use a combination of the context property name, InboundHeaders, and the target namespace http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties
. The WCF adapters copy custom SOAP headers and standard SOAP headers in the inbound messages to the InboundHeaders property. The WCF adapters also allow you to programmatically select the properties you would like to promote or write to the context properties programmatically. See SOAP Headers with Published WCF Services for more details.
The value contained in the context property is a string containing XML data with the <headers> root element, and the incoming SOAP headers are copied as child elements of the <headers> element. For more information about how to access SOAP headers with the WCF adapters, see the SDK sample "Using Custom SOAP Headers with the WCF Adapters" at https://go.microsoft.com/fwlink/?LinkId=79960.
The following code from a custom pipeline component gets the request SOAP header in a receive pipeline component for the InboundHeaders property:
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
try
{
string stringVar = inmsg.Context.Read("InboundHeaders", "http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties").ToString();
}
catch (Exception ex)
{
throw new Exception("Pipeline component exception - " + ex.Message);
}
return inmsg;
}
For more information about pipeline components, see Developing Custom Pipeline Components.
See Also
Accessing SOAP Headers in WCF Messages with Orchestrations WCF Adapters Property Schema and Properties SOAP Headers with Consumed WCF Services