[英]soap header doesnt appear in http traffic when coming from biztalk
我正在嘗試在biztalk中構造一條消息以發送到Web服務。 當我從C#調用Web服務時,我看到的流量(來自fiddler)基本上是這樣的:
<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>
這將返回預期的響應。 我在網上找到有關如何使它在BizTalk中工作的說明。 添加肥皂標頭( http://threaddump.blogspot.com/2005/01/how-to-send-soap-headers-in-biztalk.html或http://www.apress.com/9781430232643以及第2.13章的演練和代碼),我也按照它們進行操作。 但是,我無法創建您在上面看到的標題。 我看到當biz發送到Web服務時,只有琴身通過提琴手進入;
<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>
我可以將提升屬性分配給想要的字符串。 我知道這是因為,當我查看掛起的消息時(在該消息無法從服務獲得合法響應之后),我看到了該屬性,它具有在消息上下文中賦予它的值:
要清楚我為達到這一目標所做的工作; 我添加了一個具有目標名稱空間“ http://schemas.microsoft.com/BizTalk/2003/SOAPHeader ”的屬性架構,並添加了一個名為“ AuthenticationInfo”的元素,該元素的屬性架構庫設置為“ MessageContextPropertyBase”。 然后,在業務流程中將其分配給消息的提升屬性為:
MessageInwHeader(TempBizConsumeHeader.AuthenticationInfo)= @"<ns0:AuthenticationInfo xmlns:ns0=ur..."
因此,如果有人在這里看到錯誤或知道為什么我沒有在請求中看到此標頭,請告訴我。 也許我需要一個特殊的發送管道,或者需要定義一個完整的信封? 我認為,使用WCF服務(我所說的不是)有一個現成的屬性,WCFOutboundHeaders或類似的東西。 我很想成為我可以使用的其中一種...
如果我理解正確,那么您正在嘗試通過BizTalk發送端口將帶有自定義標頭的消息發送到WebService。
有一個名為WCF.OutboundCustomHeaders
內置屬性,您應該使用它,並且您的屬性分配將如下所示:
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>";
如果您將經常使用這些標題,則可能會為此創建一些幫助器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.