You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Andrew Cassin <ac...@tpg.com.au> on 2014/06/11 12:48:00 UTC

Trouble with MTOM response in tomee+ 1.6.xx

Hi all,

I've a problem with getting a response from a web service to be MTOM'ed 
rather than inline base64-encoded. I've gone all
over the web but without success. I've no problem MTOM'ing data as part 
of the request, but the client always sees inline data as observed
by wire capture. No amount of @XmlMimeType annotation seems to make any 
difference, nor @MTOM nor @BindingType annotations.

My web service is very simple:
package testmtom;

import javax.activation.DataHandler;
import javax.jws.WebService;

@WebService
public interface Server {
     public DataHandler getResult();
}

and implementation too:


package testmtom;

import java.io.File;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.ws.soap.MTOM;

@Stateless
@MTOM(enabled=true)
@WebService(serviceName="mtomService",
endpointInterface="testmtom.Server",
targetNamespace="http://test.mtom/ns")
public class ServerImpl implements Server {

     @Override
     public @XmlMimeType("*/*") DataHandler getResult() {
         return new DataHandler(
                 new FileDataSource(
                         new File(
"/home/acassin/sequence-databases/uniprot-viridiplantae-11thApril2012.fa")));
     }

}


These files are too large for anything but MTOM (>100MB). The test 
program looks as follows:

public class serviceTest {
     private final String url = 
"http://localhost:8080/testmtom/webservices/ServerImpl?wsdl";

     @Test
     public void serviceTest() {
         try {
             Service srv = Service.create(new URL(url), new 
QName("http://test.mtom/ns", "mtomService"));
             Server client = srv.getPort(Server.class, new MTOMFeature());

             DataHandler dh = client.getResult();
             assertNotEquals(null, dh);
         } catch (MalformedURLException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
     }
}

With an exception during processing of getResult() similar to:
Caused by: javax.xml.bind.UnmarshalException
  - with linked exception:
[com.ctc.wstx.exc.WstxParsingException: Text size limit (134217728) exceeded
  at [row,col {unknown-source}]: [1,142499672]]
     at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:436)
     at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:372)
     at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:349)
     at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:833)
     at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:101)
     at 
org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:861)
     at java.security.AccessController.doPrivileged(Native Method)
     at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:859)
     ... 43 more
Caused by: com.ctc.wstx.exc.WstxParsingException: Text size limit 
(134217728) exceeded
  at [row,col {unknown-source}]: [1,142499672]
     at 
com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606)
     at 
com.ctc.wstx.sr.StreamScanner.throwWfcException(StreamScanner.java:455)
     at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1124)
     at 
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:196)
     at 
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:370)
     ... 49 more


I've tried to set honor.jaxb.annotations in conf/system.properties but 
also no luck. I've looked at the tomee attachments web service example
but dont get what I am missing?

thanks in advance,

-- 
Andrew Cassin
acassin@unimelb.edu.au


Re: Trouble with MTOM response in tomee+ 1.6.xx

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

did you check org.apache.cxf.stax.maxTextLength property? More on this page
http://cxf.apache.org/docs/security.html



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-06-11 12:48 GMT+02:00 Andrew Cassin <ac...@tpg.com.au>:

> Hi all,
>
> I've a problem with getting a response from a web service to be MTOM'ed
> rather than inline base64-encoded. I've gone all
> over the web but without success. I've no problem MTOM'ing data as part of
> the request, but the client always sees inline data as observed
> by wire capture. No amount of @XmlMimeType annotation seems to make any
> difference, nor @MTOM nor @BindingType annotations.
>
> My web service is very simple:
> package testmtom;
>
> import javax.activation.DataHandler;
> import javax.jws.WebService;
>
> @WebService
> public interface Server {
>     public DataHandler getResult();
> }
>
> and implementation too:
>
>
> package testmtom;
>
> import java.io.File;
>
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
> import javax.ejb.Stateless;
> import javax.jws.WebService;
> import javax.xml.bind.annotation.XmlMimeType;
> import javax.xml.ws.soap.MTOM;
>
> @Stateless
> @MTOM(enabled=true)
> @WebService(serviceName="mtomService",
> endpointInterface="testmtom.Server",
> targetNamespace="http://test.mtom/ns")
> public class ServerImpl implements Server {
>
>     @Override
>     public @XmlMimeType("*/*") DataHandler getResult() {
>         return new DataHandler(
>                 new FileDataSource(
>                         new File(
> "/home/acassin/sequence-databases/uniprot-viridiplantae-11thApril2012.
> fa")));
>     }
>
> }
>
>
> These files are too large for anything but MTOM (>100MB). The test program
> looks as follows:
>
> public class serviceTest {
>     private final String url = "http://localhost:8080/
> testmtom/webservices/ServerImpl?wsdl";
>
>     @Test
>     public void serviceTest() {
>         try {
>             Service srv = Service.create(new URL(url), new QName("
> http://test.mtom/ns", "mtomService"));
>             Server client = srv.getPort(Server.class, new MTOMFeature());
>
>             DataHandler dh = client.getResult();
>             assertNotEquals(null, dh);
>         } catch (MalformedURLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     }
> }
>
> With an exception during processing of getResult() similar to:
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxParsingException: Text size limit (134217728)
> exceeded
>  at [row,col {unknown-source}]: [1,142499672]]
>     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.
> handleStreamException(UnmarshallerImpl.java:436)
>     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.
> unmarshal0(UnmarshallerImpl.java:372)
>     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.
> unmarshal(UnmarshallerImpl.java:349)
>     at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(
> JAXBEncoderDecoder.java:833)
>     at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(
> JAXBEncoderDecoder.java:101)
>     at org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(
> JAXBEncoderDecoder.java:861)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(
> JAXBEncoderDecoder.java:859)
>     ... 43 more
> Caused by: com.ctc.wstx.exc.WstxParsingException: Text size limit
> (134217728) exceeded
>  at [row,col {unknown-source}]: [1,142499672]
>     at com.ctc.wstx.sr.StreamScanner.constructWfcException(
> StreamScanner.java:606)
>     at com.ctc.wstx.sr.StreamScanner.throwWfcException(
> StreamScanner.java:455)
>     at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1124)
>     at com.sun.xml.bind.v2.runtime.unmarshaller.
> StAXStreamConnector.bridge(StAXStreamConnector.java:196)
>     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.
> unmarshal0(UnmarshallerImpl.java:370)
>     ... 49 more
>
>
> I've tried to set honor.jaxb.annotations in conf/system.properties but
> also no luck. I've looked at the tomee attachments web service example
> but dont get what I am missing?
>
> thanks in advance,
>
> --
> Andrew Cassin
> acassin@unimelb.edu.au
>
>