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";>b50FyY5XveGeG1s5cG1LZWsdGVv1peGXdjcwpDs</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