WSO2 ESB从代理服务发送MTOM编码的请求

WSO2 ESB从代理服务发送MTOM编码的请求,wso2,wso2esb,mtom,Wso2,Wso2esb,Mtom,我需要从WSO2 ESB代理服务发送MTOM编码的请求。 我正在设置参数: <property name="enableMTOM" value="true" scope="axis2" type="STRING"/> <property name="messageType" value="multipart/related" scope="axis2" type="STRING"/> 而且效果很好 请求的标题: POST /alfresco/cmisws/Discove

我需要从WSO2 ESB代理服务发送MTOM编码的请求。 我正在设置参数:

<property name="enableMTOM" value="true" scope="axis2" type="STRING"/>
<property name="messageType" value="multipart/related" scope="axis2" type="STRING"/>
而且效果很好

请求的标题:

POST /alfresco/cmisws/DiscoveryService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; boundary="MIMEBoundary_a62df4c2a350faee72d4e9faf54c07e7135aa06bcf30bf02"; type="application/xop+xml"; start="<0.b62df4c2a350faee72d4e9faf54c07e7135aa06bcf30bf02@apache.org>"; start-info="text/xml"
SOAPAction: "urn:mediate"
Transfer-Encoding: chunked
Host: 127.0.0.1:8181
Connection: Keep-Alive
User-Agent: Synapse-PT-HttpComponents-NIO

67b
--MIMEBoundary_a62df4c2a350faee72d4e9faf54c07e7135aa06bcf30bf02
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.b62df4c2a350faee72d4e9faf54c07e7135aa06bcf30bf02@apache.org>
但我需要以HTTP GET的形式调用我的代理服务。因此,当我需要从代理服务发送MTOM编码的请求时,我在端点定义中设置附加属性format=soap11。 消息不再是MTOM编码的-内容类型是text/xml

如果没有format=soap11属性,我将遇到错误

SequenceMediator Error while building message
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,530]
Message: The element type "body" must be terminated by the matching end-tag "</body>".
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
序列定义:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="GetDocIdFromAlfresco">

    <property name="enableMTOM" value="true" scope="axis2" type="STRING"/>
    <property name="messageType" value="multipart/related" scope="axis2" type="STRING"/>

    <payloadFactory media-type="xml">
       .
       .
       .
    </payloadFactory>

    <call>
        <endpoint>
            <address uri="http://localhost:8080/alfresco/cmisws/DiscoveryService" format="soap11"/>
        </endpoint>
    </call>
    <respond/>
</sequence>

如何从名为HTTP GET的代理服务发送MTOM编码的请求?

您不能使用GET请求发送多部分,因为它不应该包含正文,而只包含头。

我以前遇到过这样的问题:ESB似乎不允许创建启用MTOM的GET请求,因为MTOM ifie没有内容。但是对于CMIS,您确实需要这样做:CMIS规范指定所有请求,以及GET请求,都应该进行编码


最后,我通过创建一个自定义中介来解决这个问题,该中介通过OpenCMIS java api处理所有CMIS联系。

将optimize=mtom属性添加到地址端点会使它工作吗?不,optimize=mtom属性与设置具有相同的效果。是的,这是真的,但我的问题不是发送带有GET请求的多部分。我需要以HTTPGET的形式调用我的代理服务,我的代理服务将执行到multipart的转换,并调用另一个外部web服务。当我以soap-ws调用我的代理服务时,它工作得很好。但当我以HTTP GET的形式调用我的代理服务时,我需要在address元素端点中设置format=soap11属性,因为内容类型错误,它不再工作;斯瓦。但是,我无法在wire日志中看到所附文件的二进制数据。您能给出一些将SwA发送到代理并将其存储到jms存储中的想法吗
<sequence xmlns="http://ws.apache.org/ns/synapse" name="GetDocIdFromAlfresco">

    <property name="enableMTOM" value="true" scope="axis2" type="STRING"/>
    <property name="messageType" value="multipart/related" scope="axis2" type="STRING"/>

    <payloadFactory media-type="xml">
       .
       .
       .
    </payloadFactory>

    <call>
        <endpoint>
            <address uri="http://localhost:8080/alfresco/cmisws/DiscoveryService" format="soap11"/>
        </endpoint>
    </call>
    <respond/>
</sequence>