Dev*_*Now 5 c# soap web-services
使用SoapUI测试 SOAP Web 服务时,该工具会生成以下肥皂信封:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v2="http://xmlns.mydomain.com/sales/schema/quotation/v2">
<soapenv:Header/>
<soapenv:Body>
<v2:AddUpdateQuotationRequest>
<v2:UserId>UserId</v2:UserId>
<v2:PublicQKey>8de6cf8d-ea38-434d-a636-aac3a1c45999</v2:PublicQKey>
</v2:AddUpdateQuotationRequest>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
但是当我在 Visual Studio 中添加对 Web 服务的引用并测试 Web 服务时,soap 信封缺少命名空间并具有以下格式:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AddUpdateQuotationRequest>
<UserId>UserId</UserId>
<PublicQKey>8de6cf8d-ea38-434d-a636-aac3a1c45999</PublicQKey>
</AddUpdateQuotationRequest>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
我知道根据本文,可以在通过实现IClientMessageInspector创建肥皂消息后添加命名空间。
话虽如此,这是我的两个问题: