簡體   English   中英

從服務器生成的示例SOAP請求與客戶端SOAP消息不匹配

[英]Mismatch between sample SOAP request generated from server and the client SOAP message

我正在開發一個應用程序,該應用程序期望客戶端從.svc文件生成的示例SOAP請求消息,並具有以下xml結構:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
 <soap12:Body>
   <GetInfo xmlns="http://sampleuri.org/">
     <GetInfoRequest>string</GetInfoRequest>
   </GetInfo>
 </soap12:Body>
</soap12:Envelope

相應客戶端的SOAP請求具有以下xml結構:

<?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:10000/WcfSmsStringService.svc</To>
        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.sampleuri/soap/GetInfo</Action>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <GetInfoRequest xmlns="http://www.sampleuri/soap">
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
            &lt;GetInfoRequest xmlns=&quot;http://www.sampleuri/XMLSchema" /&gt;
        </GetInfoRequest>
    </s:Body>
</s:Envelope>

客戶端收到以下錯誤:

發生異常響應消息的內容類型text / html與綁定的內容類型不匹配(text / xml; charset = utf-8)。 如果使用自定義編碼器,請確保正確實施IsContentTypeSupported方法。 響應的前75個字節為:“由於發生內部服務器錯誤,因此無法顯示該頁面。”。

您能給我預約一個解決此問題的最佳方法嗎?

是否可以更改從服務器自動生成並期望的示例SOAP請求消息,或者還有另一種更好的方法?

經過長期的研究,我仍然沒有找到解決這個問題的方法。

提前致謝!

您正在發送SOAp 1.1信封,而服務器正在使用SOAP 1.2。 請注意,消息之間的SOAP名稱空間有所不同。 編輯:至少,這就是我要說的,如果響應的前幾個字節不會說“內部服務器錯誤”。 我會在您的服務器實現中尋找問題的原因。 如果客戶端消息無效,您可能會收到一些“錯誤請求”響應。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM