我正在使用WebServicesClientProtocol与用Java编写的Web服务进行通信。我添加了RequireMTOM。
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:GetRequest", RequestElementName = "GetRequestRequest", RequestNamespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.2", ResponseNamespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.2", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("RequestMessage")]
public GetRequestResponseRequestMessage GetRequest([System.Xml.Serialization.XmlElementAttribute(Namespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.2")] MessageTypeSelector MessageTypeSelector, System.Xml.XmlElement CallerInformationSystemSignature)
{
RequireMtom = true;
object[] results = this.Invoke("GetRequest", new object[] {
MessageTypeSelector,
CallerInformationSystemSignature});
return ((GetRequestResponseRequestMessage)(results[0]));
}
但我仍然遇到此异常:
Client found response content type of "Multipart/Related; start-info="text/xml"; type="application/xop+xml"; boundary="----=_Part_399341_1806348622.1545190809183"; start="<root.message@cxf.apache.org>";charset=UTF-8", but expected 'text/xml'.
The request failed with the error message:
------=_Part_399341_1806348622.1545190809183
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID:
<root.message@cxf.apache.org>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>ns2:GetResponseResponse xmlns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.2" xmlns:ns2="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.2" xmlns:ns3="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/faults/1.2"/></soap:Body></soap:Envelope>
------=_Part_399341_1806348622.1545190809183--
--.
有两个地址可以连接到服务,当我将地址用于测试服务时,它可以正常工作。
TestService地址类似于:http://smev3-n0.test.gosuslugi.ru:7500/smev/v1.2/ws
服务地址如下:http://192.168.103.9:8101/node/service/smev30v12
服务相同。
有什么问题吗?