接口 IService
<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
网络配置
<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/ ”的节点类型“元素”。找到名称为“typ:abc”和命名空间“ http://tem.com/ ”的节点类型“元素”
几天我遇到了这个错误,我在网上找到了很多解决方案,但仍然面临这个错误。有任何建议或解决方案来解决它吗?我不是还没有行动吗?