Wondering if you have enabled the following?

To enableMTOM globally for all services, users can set the "enableMTOM"
parameter to True in the Axis2.xml. When it is set, all outgoing
messages will be serialized and sent as MTOM optimized MIME messages. If
it is not set, all the binary data in the binary content nodes will be
serialized as Base64 encoded strings. This configuration can be
overriden in services.xml on the basis of per service and per operation.

<parameter name="enableMTOM">true</parameter>

 

Checkout http://axis.apache.org/axis2/java/core/docs/mtom-guide.html

 

thanks,

--

Yashwanth

 

From: Bonitz Arndt [mailto:arndt.bon...@ait.ac.at] 
Sent: Thursday, November 17, 2011 7:47 AM
To: java-user@axis.apache.org
Subject: Axis2 Service: No MTOM+XOP in response

 

Dear all,

 

I am experiencing the following problem with an Axis2 service: Upon a
service request, my service should return a SOAP message with an MTOM
attachment. I enabled XOP   in the Axis2 configuaration. All messages
are returned as XOP+MTOM responses, but the attachment is encoded as
Base64 string the SOAPEnvelope. The problem occurs with Axis2 v1.4 and
1.6. 

 

I use the following code in my service to attach the attachment :

 

byte[] covRaw = getCoverage();

final javax.activation.DataHandler dataHandler = new
javax.activation.DataHandler(new ByteArrayDataSource(covRaw,
"application/coverage"));

final OMText textData =
covElement.getOMFactory().createOMText(dataHandler, true);

covElement.addChild(textData);

 

Example response, the Base64 encoded string is located in the
wcs:Coverage element.

 

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Type: multipart/related;
boundary="MIMEBoundary_4a88a88323dbbaaffa1ad8f2065158013b50b42eba59be4b"
; type="text/xml";
start="<0.5a88a88323dbbaaffa1ad8f2065158013b50b42eba59b...@apache.org>"

Transfer-Encoding: chunked

Date: Thu, 17 Nov 2011 15:37:28 GMT

 

--MIMEBoundary_4a88a88323dbbaaffa1ad8f2065158013b50b42eba59be4b

Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: binary

Content-ID:
<0.5a88a88323dbbaaffa1ad8f2065158013b50b42eba59b...@apache.org>

 

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>

   <soapenv:Body>

      <soapenv:Envelope>

         <soapenv:Body>

            <wcs:Coverage
xmlns:wcs="http://www.opengis.net/wcs/2.0";>b50FyY5XveGeG1s5cG1LZWsdGVv1p
eGXdjcwpDs</wcs:Coverage>

         </soapenv:Body>

      </soapenv:Envelope>

   </soapenv:Body>

</soapenv:Envelope>

 

Any help would be greatly appreciated.

 

Best regards,

Arndt Bonitz

  • Axis2 S... Bonitz Arndt
    • RE... Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)
    • Re... Andreas Veithen
      • ... Bonitz Arndt
        • ... Schlarb Sven

Reply via email to