Search code examples
soapjbossresponsemtom

Disable MTOM on SOAP WS response


I have a soap web service, developed in java, which returns a file inside a tag of the XML response. The tag is set to type="xsd:base64Binary". The same software is deployed to two different servers, one running a JBoss AS 7.1.1 and one running a JBoss EAP 7.0.0.

Inspecting the response (eg. with Soap UI), the AS returns a Base64 encode of the file, directly inside the tag:

<originalDocument>JVBERi0xLj...</originalDocument>

The EAP returns a binary file, with a reference inside the tag (MTOM):

--uuid:6ec7448a-58a6-4045-9faf-2b8469edf8b5
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
....
<originalDocument>
   <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:[email protected]"/>
</originalDocument>
....
--uuid:6ec7448a-58a6-4045-9faf-2b8469edf8b5
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
%PDF-1.4
...

Is this a configuration of the JBoss? Or maybe an Apache configuration? How can I force the AS to use Base64 encode?

Please note that I'm referring to the response of the endpoint, and not the request from client. And please note also that the software is the same. I'd like to have a server configuration, not a software change.

Thank you.


Solution

  • My solution was to remove xmime:expectedContentTypes="application/octet-stream" from the XSD node, and to remove the @MTOM annotation. This way the output is always base64. I still did not understand why on the old application server the output was base64, even with @MTOM annotation.