【问题标题】:WSO2 ESB WS-Security with MTOM带有 MTOM 的 WSO2 ESB WS-Security
【发布时间】:2016-09-28 01:45:48
【问题描述】:

拥有 WSO2 ESB 4.9.0,是否可以启用客户端 WS-Security,为端点设置策略,外部(后端)服务返回 MTOM 附件?

要求:外部后端服务要求对请求进行签名并返回(可选)MTOM 响应,该响应未签名(普通)。

一旦使用 Rampart 模块并且入站策略生效,响应就不会通过简单的代理,但以下异常:

Caused by: org.apache.ws.security.WSSecurityException: Error in converting SOAP Envelope to Document; nested exception is:
        org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Expected xop:Include as the sole child of an element information item (see section 3.2 of http://www.w3.org/TR/xop10/)
        at org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:149)
        at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:268)
        ... 11 more
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Expected xop:Include as the sole child of an element information item (see section 3.2 of http://www.w3.org/TR/xop10/)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
        at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
        at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
        at org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:84)
        ... 12 more
Caused by: javax.xml.stream.XMLStreamException: Expected xop:Include as the sole child of an element information item (see section 3.2 of http://www.w3.org/TR/xop10/)
        at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader.next(XOPDecodingStreamReader.java:187)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
        ... 15 more

但是 - 有 Include 元素:

<inc:Include href="cid:30545cee-7014-4149-8b77-7014e3e12a8c@xxxxxxx" xmlns:inc="http://www.w3.org/2004/08/xop/include"/>

尝试在本地测试服务(创建类似于外部服务的模型服务)我遇到了一个异常:

Caused by: org.apache.axiom.om.OMException: Part content ID cannot be blank for non root MIME parts
        at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:648)
        at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:350)

我认为这与问题 https://wso2.org/jira/browse/ESBJAVA-3585 有关。它是相关的还是我有错误的模型服务? MTOM 是否在启用安全策略的情况下工作?

【问题讨论】:

    标签: wso2esb ws-security mtom


    【解决方案1】:

    似乎涉及两个问题:

    Caused by: javax.xml.stream.XMLStreamException: Expected xop:Include as the sole child of an element information item (see section 3.2 of http://www.w3.org/TR/xop10/)
    

    这是由后端服务的“漂亮打印”功能引起的。 Axis 2 严格执行规范,其中 xop:Include 元素必须是唯一且唯一的子元素,因此不允许有空格。

    org.apache.axiom.om.OMException: Part content ID cannot be blank for non root MIME parts
    

    这似乎是一个错误,目前尚未解决。 https://wso2.org/jira/browse/ESBJAVA-3585

    解决方法可以将消息类型更改为 text/xml(有效地将 base64 有效负载插入 XML 元素),适用于小/合理的附件大小。

    如果附件可以更大或者负载高,可以考虑将附件存储为文件,只传回文件名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-02
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      • 2011-08-31
      • 1970-01-01
      • 2017-02-07
      • 1970-01-01
      相关资源
      最近更新 更多