1
我有一個.NET 4.0 Web服務,其中有一個targetNamespace爲「http://tempuri.org」WSDL生成時。客戶向我發送一個xmlns設置爲「uri:company:agent」的SOAP信封(請參閱下面的示例)由於命名空間不同,我的服務拒絕SOAP信封。WSDL Xmlns更改
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:company:agent">
<SOAP-ENV:Body>
<ns1:send_message xmlns="urn:company:agent">
<item1>abc</item1>
我收到以下錯誤:
<faultstring xml:lang="en-US">Error in deserializing body of request message for operation 'send_message'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'send_message' and namespace 'http://tempuri.org/'. Found node type 'Element' with name 'ns1:send_message' and namespace 'urn:company:agent'</faultstring>
我的問題是:我找不到在哪裏改的Visual Studio 2010中我的項目的命名空間,以反映「URI:公司:代理商「而不是」http://tempuri.org/「。我已經看過很多,但是我所做的任何更改都沒有反映在WSDL中。
..我想我可以在上面輸錯....我有一個。 svc文件不是asmx文件。這會有所作爲嗎? – 2010-11-08 16:03:53
更新了我的答案,第二部分應該適合你。 – brendan 2010-11-08 16:14:10
謝謝!這是我必須添加到每種方法嗎?我添加了服務行爲,但現在所有的公共方法現在在WSDL中更長時間可見了? – 2010-11-08 16:34:07