-->

从与内容类型被发送为“多部分/相关的”防止SOAP消息(Prevent a SOAP message

2019-09-21 09:21发布

我从web服务客户端发送SOAP消息(由IBM RAD 7.5生成的代码)到主机,并且将其与一个web服务的故障和在主机的日志读作‘在序言不允许内容’的消息。 当我发送具有了SoapUI或简单的apache的HttpClient测试客户端相同的内容,当接收到消息,并且由主机处理,并且我得到预期的响应。

据我所知道的,所不同的是在正在发送的HTTP标头。

RAD生成的客户:


POST /ws/mycompany/webservice/SomeWebServiceName/soap11 HTTP/1.1
Host: http://host.com/ws/mycompany/webservice/SomeWebServiceName/soap11
Accept: application/soap+xml,multipart/related,text/*
User-Agent: IBM WebServices/1.0
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Connection: Keep-Alive
SAVECONNECTION: 7814631881345232300226
IBM-WAS-CLIENT: TRUE
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_E54EE0B5F8ED486B811345232300773; type="application/xop+xml"; start=""; start-info="text/xml"
Content-Length: 2553
Date: Fri, 17 Aug 2012 19:38:20 GMT

--MIMEBoundaryurn_uuid_E54EE0B5F8ED486B811345232300773
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: 

<soapenv:Envelope...
--MIMEBoundaryurn_uuid_E54EE0B5F8ED486B811345232300773--

对于了SoapUI:

POST /ws/mycompany/webservice/SomeWebServiceName/soap11 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 2732
Host: localhost:9111
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope...

而一个非常简单的客户使用Apache的HttpClient来实现:

POST /ws/mycompany/webservice/SomeWebServiceName/soap11 HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Transfer-Encoding: chunked
Host: localhost:9111

8da
<soapenv:Envelope... 
0

据我所知,这三者之间的区别在于,通过由RAD-生成的客户端生成的请求具有内容类型“多”,并限定了MIME边界。 我没有访问主机系统,但似乎该主机不能处理多的消息。

有没有办法迫使IBM客户端代码发送邮件一样简单了SoapUI或HttpClient的?

Answer 1:

它看起来像问题设置MTOM到true的BindingProvider。

我改变了我的代码如下:

    SOAPBinding soapBinding = (SOAPBinding) bindProvider.getBinding();
    soapBinding.setMTOMEnabled(false);

和一切工作正常。 我认为MTOM设置为true ,因为在应用程序中其他客户机需要它,这个代码看起来它是基于其他客户的代码。 由于这个Web服务调用实际上并不需要MTOM,关闭它是没有问题的。

此外,见: http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Ftwbs_enablemtom.html



文章来源: Prevent a SOAP message from being sent with content-type as “multipart/related”