【问题标题】:MTOM not working after upgrading from weblogic 11g to 12c从 weblogic 11g 升级到 12c 后 MTOM 不工作
【发布时间】:2015-05-26 08:24:15
【问题描述】:

我有一个网络服务,用户可以使用文档 ID 作为输入来请求文档。它是这样实现的,只是示例是用于上传的: http://docs.oracle.com/cd/E15523_01/web.1111/e13734/mtom.htm#WSADV143

我的WebService实现类:

@HandlerChain(file = "handlers.xml")
@BindingType("http://schemas.xmlsoap.org/wsdl/soap/http")
@StreamingAttachment(parseEagerly=false, memoryThreshold=4000000L)
@MTOM(threshold=3072)
@WebService(name="MyServicePortType",
    serviceName="MyService",
    targetNamespace="http://my.services.example.com")
public class MyServiceImpl implements MyService, Serializable {

/**
 *
 */
private static final long serialVersionUID = 1L;

@Resource
private WebServiceContext wsctx;

private MyRemote ejbRemote;
private EJBClientHelper ejbClientHelper;

public ElkomImpl() {
    ejbClientHelper = new EJBClientHelper();
}

@WebMethod
public @XmlMimeType("application/octet-stream") DataHandler fetchDocument( @WebParam(name = "reference")String reference) {
    SOAPFault soapFault = null;
    Logger log = ApplicationLogFactory.getLogger(this.getClass());
    try {
        log.debug("Should fetch document with reference " + reference);

        elkomRemote = ejbClientHelper.getElkomRemote();
        DataHandler dh = ejbRemote.fetchDocument(reference);
        if(dh == null) {
            throw new SOAPException();
        }
        return dh;
    } catch (NamingException e) {
        log.fatal(Consts.NAMING_EXCEPTION, e);
        throw new SOAPFaultException();
    } catch (PropsFileException e) {
        log.fatal(Consts.PROPS_FILE_EXCEPTION, e);
        throw new SOAPFaultException();
    } catch (SOAPException e) {
        log.error("SOAPException", e);
        throw new SOAPFaultException();
    } 
}
}

这是一个 maven 项目,在更新之前,我使用 weblogic 库来处理 ejb + JAX-WS RI 2.2.5。现在更新后,weblogic 强制使用 JAX-WS RI 2.2.10-b140319.1121。这个版本坏了吗?

来自运行 WebLogic 11g 的 Web 服务的响应:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
  <ns2:fetchDocumentResponse xmlns:ns2="http://my.services.example.com">
     <return>
        <xop:Include href="cid:58eaad0c-4723-44c0-bada-4d9bd237b935@example.jaxws.sun.com" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
     </return>
  </ns2:fetchDocumentResponse >

文档在附件中。

运行 WebLogic 12c 的响应

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
  <ns0:hentDokumentResponse xmlns:ns0="http://my.services.example.com">
     <return>SUkqADRTAAAAgLJIAICgAgLJIAICySAC ...</return>
  </ns0:hentDokumentResponse>
</S:Body>
</S:Envelope>

编辑: Weblogic 11g 使用 Java EE 6,12c 使用 Java EE 7。Java 版本:

java 版本“1.7.0_67” Java(TM) SE 运行时环境 (build 1.7.0_67-b01) Java HotSpot(TM) 64 位服务器 VM(内部版本 24.65-b04,混合模式)

Document 只是一个 base64 编码的字符串。我们需要它像以前一样......其他人有这个问题吗?并找到了解决方案?

【问题讨论】:

  • 12c is using Java EE 7 - 这并不完全正确。 WLS 12.1.1 到 12.1.3 是 Java EE 6。下一个 12.x(可能是 12.2.1)将是 Java EE 7。
  • 好吧,它还没有完全通过 Java EE 7 认证。已经在 Oracle 创建了一张票,但他们说它似乎按照规范工作。票证目前仍未解决。

标签: java web-services weblogic12c mtom


【解决方案1】:

不知道它们在 WLS12c 中发生了什么变化,但我们遇到了同样的问题。我们的解决方案是在客户端使用 Accept 标头:

mimeHeaders.setHeader("Accept", "application/xop+xml;");

追踪:

  • 服务器上的@Mtom "threshold" 没有做任何改变
  • 用axis2替换消息工厂并强制“setProcessMTOM(true)”没有做任何改变
  • 普通 SOAP 客户端 (MessageFactory/SoapMessage) 与 Accept 标头配合良好 -> 通过 xop:Include 响应
  • jaxws 客户端无需任何更改即可工作

@baron5 提到的任何指向勾选的链接

【讨论】:

    猜你喜欢
    • 2018-06-14
    • 2019-11-17
    • 1970-01-01
    • 2019-06-19
    • 1970-01-01
    • 2012-05-12
    • 2017-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多