0

I need to send MTOM encoded request from WSO2 ESB proxy service. I'm setting parameters:

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

and it works fine.

Headers of the request:

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>

But I need to call my proxy service as HTTP GET. So when I need to send MTOM encoded request from proxy service, I'm setting additional attribute format="soap11" in the endpoint definition. And message is no longer MTOM encoded - Content-Type is 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>

Without format="soap11" attribute I'am getting error

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 deffinition:

<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>

How can I send MTOM encoded request from proxy service called as HTTP GET?

Community
  • 1
  • 1
tyfyh
  • 333
  • 2
  • 15

2 Answers2

0

You can not send multipart with GET request, as it should not contain body, only a header.

user3714601
  • 1,156
  • 9
  • 27
  • Yes, that's true, but my question is not about sending multipart with GET request. I need to call my proxy service as HTTP GET, and my proxy service will do the transformation to multipart and call another (external) web service. When i'm calling my proxy service as soap ws it works fine. But when I'm calling my proxy service as HTTP GET I need to set format="soap11" attribute in address element (endpoint) and it's not work anymore - because of wrong content-type. – tyfyh May 25 '15 at 07:17
0

I encountered this before: it seems that ESB does not allow creating a mtom-enabled get-request, because there is no content to mtom-ifie. But for CMIS, you really need this: the CMIS specs specify that all request, also the GET requests, should be encoded.

In the end I worked around it by creating a custom mediator that does all CMIS contact via the OpenCMIS java api.

  • I am using a proxy which receives SOAP message with attachments; SwA. However i cannot see and binary data of the attached file in the wire log. can you give some idea of sending the SwA to a proxy and storing it into a jms store – Sidharth Dash Jan 19 '17 at 15:21