How to Pass Custom WCF Soap Headers from BizTalk using WCF.OutboundCustomHeaders
I needed to call a WCF webservice from BizTalk that required three SOAP fields. In addition to Username and Password (standard), they had one custom field called ApplicationID.
Code in Message Assignment Shape
xmlDocSoapHeader.LoadXml(
"<headers>" +
" <Username>" + strSOAPUserFromSSO + "</Username>" +
" <Password>" + strSOAPPasswordFromSSO + "</Password>" +
" <ApplicationID>" + strSOAPAppIDFromSSO + "</ApplicationID>" +
"</headers>"
);
msgRcvdEquipReq(WCF.OutboundCustomHeaders) = xmlDocSoapHeader.OuterXml;
I used the standard “Add Generated Schema” and “Consume WCF Service” wizard, but that didn’t provide any help with the SOAP Headers. I read some blogs that talked about creating a custom SOAP schema, promoting fields, and so-on, and perhaps that would work, but ultimately the above is what worked fine.