使用SOAPUI请求时,我的Mock-Service正常工作。
我现在正尝试从WCF客户端与该模拟服务进行通信,但收到以下错误消息:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>Server</soap:Value>
</soap:Code>
<soap:Reason>
<!--1 or more repetitions:-->
<soap:Text xml:lang="en">Missing operation for soapAction [null] and body element [null] with SOAP Version [SOAP 1.2]</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
似乎,模拟服务需要HTTP Content-Type标头中的action属性。除了action属性,这些请求完全相同(由提琴手记录)。
在SOAP-UI中更改请求时,将“跳过SOAP操作”选项从false切换为true,我得到的错误消息与WCF客户端相同。
我正在使用WS-Addressing。
查看请求。
工作:
POST https://localhost:1234/mock_Management HTTP/1.1
Connection: close
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="http://foo.bar/CreateID"
Content-Length: 871
Host: localhost:1234
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:MessageID>urn:uuid:0458e1a6-83fd-46c8-80f2-641ffb8783e7</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://localhost/Test/Management.svc</a:To>
<a:Action s:mustUnderstand="1">http://foo.bar/CreateID</a:Action></s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</s:Envelope>
(从WCF开始)无效:
POST https://localhost:1234/mock_Management HTTP/1.1
Connection: close
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8
Content-Length: 871
Host: localhost:1234
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:MessageID>urn:uuid:0458e1a6-83fd-46c8-80f2-641ffb8783e7</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://localhost/Test/Management.svc</a:To>
<a:Action s:mustUnderstand="1">http://foo.bar/CreateID</a:Action></s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</s:Envelope>
我可以告诉模拟服务使用WS-Addressing吗?