I am trying to construct a message in biztalk to send out to a web service. When I call the web service from c# i see the traffic(from fiddler) as basically this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:AuthenticationInfo xmlns:h="urn:Ticket" xmlns="urn:Ticket" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<userName>user_name</userName>
<password>password</password>
<authentication/>
<locale/>
<timeZone/>
</h:AuthenticationInfo>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CreateTroubleTicket xmlns="urn:Ticket">
<ServiceID>asd</ServiceID>
<ServiceType>service Type</ServiceType>
<Impact>1</Impact>
<Priority>1 - Critical</Priority>
</CreateTroubleTicket>
</s:Body>
</s:Envelope>
and this returns an expected response. I found instructions online on how to get this working in BizTalk, ie. add the soap header ( http://threaddump.blogspot.com/2005/01/how-to-send-soap-headers-in-biztalk.html , or http://www.apress.com/9781430232643 where there is a walkthrough and code for chapter 2.13) and I have followed them. However I haven't been able to create the header you see above. I see just the body come through fiddler when biz sends off to the web service;
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><ns0:CreateTroubleTicket xmlns:ns0="urn:Ticket">
<ns0:ServiceID>ServiceID_0</ns0:ServiceID>
<ns0:ServiceType>ServiceType_0</ns0:ServiceType>
<ns0:Impact>1</ns0:Impact>
<ns0:Priority>1 - Critical</ns0:Priority>
</ns0:CreateTroubleTicket></s:Body></s:Envelope>
I can get the promoted property assigned to the string I want. I know this because when I look at my suspended message(after it fails to get a legit response from the service) I see that property with the value I gave it in the message context:
To be clear about what I did to get this far; I addded a property schema with target namespace ' http://schemas.microsoft.com/BizTalk/2003/SOAPHeader ' and with a single element named 'AuthenticationInfo' that has its Property Schema Base set to 'MessageContextPropertyBase'. I then assign this in an orchestration to the promoted property of the message as:
MessageInwHeader(TempBizConsumeHeader.AuthenticationInfo)= @"<ns0:AuthenticationInfo xmlns:ns0=ur..."
So if anyone sees something wrong here or knows why I am not acutally seeing this header in the request let me know. Maybe I need a special send pipeline, or I need to define an entire envelope? I think with WCF services(which the one I'm calling is not) there is a ready made property, WCFOutboundHeaders or some such thing. Id love for there to be one of those I could use...
If I understand you correctly, you are trying to send message with custom header to WebService through BizTalk send port.
There is built-in property named WCF.OutboundCustomHeaders
, you should use it and your property assignment would be be like this:
MessageInwHeader(WCF.OutboundCustomHeaders) = "<headers><h:AuthenticationInfo xmlns:h=\"urn:Ticket\" xmlns=\"urn:Ticket\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><userName>user_name</userName></h:AuthenticationInfo></headers>";
If you are going to frequently use these headers, probably you may create some helper for this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.