若要访问管道组件中的 SOAP 标头上下文属性,请使用上下文属性名称和目标命名空间的组合,如 在业务流程中使用 SOAP 标头中所述。
下面的代码示例设置属性名称 OrigDest 的发送管道组件中的请求 SOAP 标头:
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
try
{
string stringVar = "<?xml version=\"1.0\"?>
<OrigDest xmlns=\"http://SOAPHeaderSchemas.OrigDestSOAPHeader\">
<Origination>Home</Origination>
<Destination>Work</Destination>
</OrigDest>";
inmsg.Context.Write("OrigDest","http://schemas.microsoft.com/BizTalk/2003/SOAPHeader", stringVar);
}
catch (Exception ex)
{
throw new Exception("Pipeline component exception - " + ex.Message);
}
return inmsg;
}
有关管道组件的详细信息,请参阅 开发自定义管道组件。
注释
在通过业务编排使用(调用)Web 服务时,SOAP 适配器仅支持直通样式的接收和发送管道。 可以使用自定义管道,但它不能包含修改消息正文部分的组件。 这些组件包括 XML 汇编程序、XML 反汇编程序和 XML 验证程序组件。