【问题标题】:Prevent SOAP response in Liberty Content-Type: multipart/related阻止 Liberty Content-Type 中的 SOAP 响应:multipart/related
【发布时间】:2017-09-28 12:44:39
【问题描述】:

我们有一个当前在 WAS8 上运行的应用程序。现在我们将此应用程序迁移到 Liberty。目前,我们遇到的问题是此应用程序的 SOAP 响应的内容类型为 multipart/related。看起来像这样:

HTTP/1.1 200 OK
X-Powered-By: Servlet/3.1
Content-Type: multipart/related; type="application/soap+xml"; boundary="uuid:acacdbe0-a9a8-46cc-aedf-58570a630ff7"; start="<root.message@cxf.apache.org>"; start-info="application/soap+xml"
Content-Language: en-DE
Content-Length: 670
Date: Thu, 28 Sep 2017 12:00:16 GMT


--uuid:acacdbe0-a9a8-46cc-aedf-58570a630ff7
Content-Type: text/xml; charset=UTF-8; type="application/soap+xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope>....</soap:Envelope>
--uuid:acacdbe0-a9a8-46cc-aedf-58570a630ff7--

这对我们不利,因为其他客户端可能会遇到解析问题。

使用 WAS8,响应的内容类型为 application/soap+xml;charset=UTF-8;action="mySoapResponse",而没有 uuid 和其他内容。

Here 我发现了与我的问题类似的东西,但不完全是。我们也定义了SOAPBinding,但作为我的@WebService 的注释看起来像这样: @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)@BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)

为了使应用程序在 Liberty 上运行,我们必须将部署描述符 (web.xml) 从版本 2.4 更新到 3.0。我猜这也改变了应用程序的行为。

主要原因真的是因为SOAPBinding 注释还是其他原因?

更新: 以下是 WAS8 应用服务器的响应以供比较:

HTTP/1.1 200 OK
Date: Wed, 04 Oct 2017 06:24:22 GMT
Cache-Control: private
Cache-Control: max-age=10
X-Frame-Options: SAMEORIGIN
X-Powered-By: Servlet/3.0
Content-Length: 403
Keep-Alive: timeout=20
Connection: Keep-Alive
Content-Type: application/soap+xml; charset=UTF-8; action="mySoapResponse"
Content-Language: en-US

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope ...>...</soapenv:Envelope>

更新 2:

我注意到 Liberty SOAP 响应还获得了一个不在 WAS8 响应中的 &lt;env:header&gt;

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"/>
    <soap:Body>...

所以背景中似乎发生了一些事情。我查看了 WSDL,但没有定义 header,也没有定义一些 multipart。 如何追溯这些步骤并查看此设置是在哪里对我的响应进行的?

【问题讨论】:

    标签: web-services jakarta-ee soap websphere websphere-liberty


    【解决方案1】:

    也许 Liberty 正在自动使用 MTOM。如果您在 SOAP 信封中看到 &lt;xop:Include..,它可能是 MTOM。您可以通过向 WebService 添加注释来关闭它,@MTOM(enabled="false")

    【讨论】:

    • 我将此添加到我的网络服务中,但它仍然以相同的方式响应。但是我也没有在我的 SOAP 信封中看到 ,即使没有使用 @MTOM。那么这是否意味着它是另一回事?
    【解决方案2】:

    根据 IBM 支持,CXF (Liberty) 的这种行为是由于我的一个 JAXB 类 中的注释 @XmlAttachmentRef。删除它会导致非多部分响应。不幸的是,当我这样做时,发送的附件将无法正确处理,并且 MIME 类型将丢失。

    目前我们有 IBM 支持调查此问题,如果可以在 CXF (Liberty) 中以某种方式解决此问题,因为在 Axis2 (tWAS8.0) 中它的行为有所不同。我会尽量保持更新。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-05
      • 2012-11-13
      • 2017-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多