[英]SOAP Action mismatch error while testing a WCF service with SoapUI
我正在使用 SOAPUI 中的示例輸入測試 WCF 服務。 當我開始跑步時,我收到如下 SOAP 異常:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>a:ActionMismatch</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://XXX.XX.XXXX/IXXXXXX/AddOrderInfromation'.</s:Text>
</s:Reason>
<s:Detail>
<a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
</s:Detail>
</s:Fault>
</s:Body>
</s:Envelope>
在博客中,他們要求添加 Soap Action 。 如何在下面的請求中添加 Soap Action:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wkus="http://XXX.XX.XXXX/IXXXXXX">
<soap:Header />
<soap:Body>
<ns1:AddOrderInfromation>
<!--Optional:-->
<ns1:inputsting>
<ns1:AddOrderInfromation>
<ns1:OrderNo>4500146</ns1:OrderNo>
<ns1:OrderDate>08/22/2014</ns1:OrderDate>
<ns1:TotalItems>1</ns1:TotalItems>
</ns1:AddOrderInfromation>
</ns1:inputsting>
</ns1:AddOrderInfromation>
請建議。 提前致謝
這可能是一個 WS-A 尋址問題。
在請求的 WS-A 選項卡中,選中“啟用 WS-A 尋址”。 您可能還必須選中“添加默認值:至”。
您的 Web 服務正在返回一個 SOAPFault,它表示 Web 服務需要一個 SOAP Action http 標頭。 為了在來自 SOAPUI 的 SOAP 請求中添加 SOAP 操作,您必須添加一個名為SOAPAction
的 http 標頭,執行下一步操作:
Header(0)
、 Attachments(0)
...),打開Header(0)
選項卡。然后使用+
添加按鈕,添加一個帶有SOAPAction
名稱和您的值的標題: 希望這可以幫助,
我也遇到了這個問題,並通過在 SopaUI 中啟用 WS-A 尋址來解決它。 SoapUI 截圖
xml請求中的語法不正確也會出現這個錯誤
例如:如果缺少結束標記,它將拋出相同的錯誤
</soap:Body>
</soap:Envelope>
在下面的代碼中
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wkus="http://XXX.XX.XXXX/IXXXXXX">
<soap:Header />
<soap:Body>
<ns1:AddOrderInfromation>
<ns1:inputsting>
<ns1:AddOrderInfromation>
<ns1:OrderNo>4500146</ns1:OrderNo>
<ns1:OrderDate>08/22/2014</ns1:OrderDate>
<ns1:TotalItems>1</ns1:TotalItems>
</ns1:AddOrderInfromation>
</ns1:inputsting>
</ns1:AddOrderInfromation>
或者如果有這樣的意外語法
<ns1:OrderNo>4500146**<ns1:OrderNo>**
代替
<ns1:OrderNo>4500146**</ns1:OrderNo>**
或這個
<ns1:**OrderNo**4500146</ns1:OrderNo>
代替
<ns1:**OrderNo>**4500146</ns1:OrderNo>
我剛剛遇到了類似的問題。 我解決了如下問題;
https://blabla.com/xyz.svc?wsdl --> 轉到瀏覽器上的 wsdl 網址,您將在方法中看到一些操作;
我使用 python 進行開發,並添加了如下所示的soapAction;
headers = {'Content-type': 'text/xml;charset=UTF-8',
'SOAPAction': 'http://tempuri.org/IArasCargoIntegrationService/GetQueryXML'
}
它奏效了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.