You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bonitz Arndt <Ar...@ait.ac.at> on 2011/11/17 16:47:04 UTC

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

AW: Axis2 Service: No MTOM+XOP in response

Posted by Schlarb Sven <sv...@onb.ac.at>.
Hi,

I had the same issue and also got it working by deactivating SwA.
Maybe it's worth a short comment in the axis2 configuration.

Regards,

Sven
> -----Ursprüngliche Nachricht-----
> Von: Bonitz Arndt [mailto:Arndt.Bonitz@ait.ac.at] 
> Gesendet: Freitag, 18. November 2011 09:08
> An: java-user@axis.apache.org
> Betreff: AW: Axis2 Service: No MTOM+XOP in response
> 
> Hello Andreas,
> 
> Thank you very much! This solved my problem. 
> 
> Best regards,
> Arndt
> 
> Arndt F. Bonitz
> Department Safety & Security
> 
> AIT Austrian Institute of Technology GmbH
> 2444 Seibersdorf | Austria
> Tel.: +43(0) 50550-3169
> arndt.bonitz@ait.ac.at  |  http://www.ait.ac.at
> 
> FN: 115980 i HG Wien  |  UID: ATU14703506 This email and any 
> attachments thereto, is intended only for use by the 
> addressee(s) named herein and may contain legally privileged 
> and/or confidential information. If you are not the intended 
> recipient, please notify the sender by return e-mail or by 
> telephone and delete this message from your system and any 
> printout thereof. Any unauthorized use, reproduction, or 
> dissemination of this message is strictly prohibited. Please 
> note that e-mails are susceptible to change. AIT Austrian 
> Institute of Technology GmbH shall not be liable for the 
> improper or incomplete transmission of the information 
> contained in this communication, nor shall it be liable for 
> any delay in its receipt.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Gesendet: Donnerstag, 17. November 2011 20:02
> An: java-user@axis.apache.org
> Betreff: Re: Axis2 Service: No MTOM+XOP in response
> 
> The response is actually not an MTOM message but a SwA message.
> Probably you have enabled both. In that case SwA takes 
> precedence over MTOM because MTOM is simply an alternative 
> serialization of an XML message while SwA is a different type 
> of message. In addition, SwA doesn't allow the SOAP stack to 
> automatically convert a base64Binary value to an attachment, 
> and therefore the DataHandler is serialized as a base64Binary 
> value. Avoid enabling SwA on that service and it should work.
> 
> Andreas
> 
> On Thu, Nov 17, 2011 at 16:47, Bonitz Arndt 
> <Ar...@ait.ac.at> wrote:
> > 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_4a88a88323dbbaaffa1ad8f2065158013b50b42eba59be4
> > b";
> > type="text/xml";
> > 
> start="<0.5a88a88323dbbaaffa1ad8f2065158013b50b42eba59be4b@apa
> che.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....@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">b50FyY5XveGeG1s5cG1LZWsdGVv
> > 1peGXdjcwpDs</wcs:Coverage>
> >
> >          </soapenv:Body>
> >
> >       </soapenv:Envelope>
> >
> >    </soapenv:Body>
> >
> > </soapenv:Envelope>
> >
> >
> >
> > Any help would be greatly appreciated.
> >
> >
> >
> > Best regards,
> >
> > Arndt Bonitz
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


AW: Axis2 Service: No MTOM+XOP in response

Posted by Bonitz Arndt <Ar...@ait.ac.at>.
Hello Andreas,

Thank you very much! This solved my problem. 

Best regards,
Arndt

Arndt F. Bonitz
Department Safety & Security

AIT Austrian Institute of Technology GmbH
2444 Seibersdorf | Austria
Tel.: +43(0) 50550-3169 
arndt.bonitz@ait.ac.at  |  http://www.ait.ac.at

FN: 115980 i HG Wien  |  UID: ATU14703506
This email and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient, please notify the sender by return e-mail or by telephone and delete this message from your system and any printout thereof. Any unauthorized use, reproduction, or dissemination of this message is strictly prohibited. Please note that e-mails are susceptible to change. AIT Austrian Institute of Technology GmbH shall not be liable for the improper or incomplete transmission of the information contained in this communication, nor shall it be liable for any delay in its receipt.


-----Ursprüngliche Nachricht-----
Von: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Gesendet: Donnerstag, 17. November 2011 20:02
An: java-user@axis.apache.org
Betreff: Re: Axis2 Service: No MTOM+XOP in response

The response is actually not an MTOM message but a SwA message.
Probably you have enabled both. In that case SwA takes precedence over
MTOM because MTOM is simply an alternative serialization of an XML
message while SwA is a different type of message. In addition, SwA
doesn't allow the SOAP stack to automatically convert a base64Binary
value to an attachment, and therefore the DataHandler is serialized as
a base64Binary value. Avoid enabling SwA on that service and it should
work.

Andreas

On Thu, Nov 17, 2011 at 16:47, Bonitz Arndt <Ar...@ait.ac.at> wrote:
> 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....@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....@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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Service: No MTOM+XOP in response

Posted by Andreas Veithen <an...@gmail.com>.
The response is actually not an MTOM message but a SwA message.
Probably you have enabled both. In that case SwA takes precedence over
MTOM because MTOM is simply an alternative serialization of an XML
message while SwA is a different type of message. In addition, SwA
doesn't allow the SOAP stack to automatically convert a base64Binary
value to an attachment, and therefore the DataHandler is serialized as
a base64Binary value. Avoid enabling SwA on that service and it should
work.

Andreas

On Thu, Nov 17, 2011 at 16:47, Bonitz Arndt <Ar...@ait.ac.at> wrote:
> 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....@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....@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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: Axis2 Service: No MTOM+XOP in response

Posted by "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>.
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.Bonitz@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....@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....@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