У меня Mock-Service, который работает нормально при использовании запроса SOAPUI.
Я сейчас пытаюсь связаться с этим фиктивным сервисом из клиента 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>
Кажется, что фиктивной службе нужен атрибут action в заголовке HTTP Content-Type. Запросы точно такие же (записаны fiddler), за исключением атрибута action.
При изменении запроса в SOAP-UI, переключая опцию «Пропустить SOAP Action» с 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?