接口IService錯誤在反序列化請求消息的主體進行操作 'ABC'
<OperationContract(Action:="urn:abc")> _
<WebInvoke(BodyStyle:=WebMessageBodyStyle.Bare, Method:="POST")>
Function abc(a as String) As String
方法服務
Public Function abc(a as String) As String Implements IService.abc
'Method
End Function
的Web.Config
<services>
<service name="Service.IServices">
<endpoint address="" binding="customBinding" contract="Service.IServices" bindingConfiguration="httpSoap12">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<customBinding>
<binding name="httpSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
請求消息
POST http://localhost/Services.svc HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="urn:abc"
Content-Length: 1230
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
錯誤
錯誤反序列化操作'abc'請求消息的主體。 OperationFormatter遇到無效的消息體。預計會找到名爲'abc'和名稱空間'http://tempuri.org/'的節點類型'Element'。找到名爲'typ:abc'的節點類型'Element'和命名空間'http://tem.com/'
我面對這個錯誤幾天,我在web上發現了很多解決方案,但仍然面臨着這個錯誤。有任何建議或解決方案來解決它?我還沒有得到這個動作嗎?
你使用什麼測試客戶端? – Jocke
爲什麼不使用UriTemplate? – Jocke
看看這個博客文章:http://social.msdn.microsoft.com/Forums/vstudio/en-US/dc3344df-f0e9-4cd3-9d5a-81f4cd6de136/why-does-bodystyle-webmessagebodystylebare-removes-the-user -defined命名空間換了根?論壇= WCF – Jocke