【发布时间】:2015-08-04 08:38:25
【问题描述】:
我需要从 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 编码 - Content-Type 是 text/xml。
POST /alfresco/cmisws/DiscoveryService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml
Transfer-Encoding: chunked
Host: 127.0.0.1:8181
Connection: Keep-Alive
User-Agent: Synapse-PT-HttpComponents-NIO
678
--MIMEBoundary_c62df4c2a350faee60d6513af54c07e7035aa06bcf30bf02
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.d62df4c2a350faee60d6513af54c07e7035aa06bcf30bf02@apache.org>
没有 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 编码请求?
【问题讨论】:
-
将 optimize="mtom" 属性添加到您的地址端点会使其工作吗?
-
否,optimize="mtom" 属性与设置
的效果相同。