8 Replies Latest reply on Mar 18, 2010 5:09 AM by Karl Determe

    [JBossWS] MTOM client parsing exception

    Karl Determe Newbie
      Hello,

       

      I have built a top-down servlet-based web service with the  JBossWS-Native 3.2.2. This web service build a PDF file (it is dumped on the server-side and is correct) and is defined as a "base64Binary" type in the WSDL and binded as a DataHandler:

       

       

      XSD definition

      <element name="getMap2PdfResponse">

        <complexType>

          <sequence>

            <element name="pdffile" type="base64Binary" minOccurs="0" xmime:expectedContentTypes="application/pdf"/>

          </sequence>

        </complexType>

      </element>

       

      Client proxy:

      DataHandler handler = map2Pdf.getMap2Pdf(.......)

       

      SEI implementation Class

      @WebService(name = "Map2PdfImpl",

      wsdlLocation = "WEB-INF/wsdl/Map2PDFService.wsdl",

      serviceName = "Map2Pdf",

      targetNamespace = "http://map2pdf",

      portName = "Map2PdfImplPort",

      endpointInterface = "map2pdf.Map2Pdf")

      @WebContext(contextRoot = "/WSMap2Pdf")

      public class Map2PdfImpl implements Map2Pdf {

      .......................;

      }

       

       

      The problem is that I often receive the following exception. Is there - by default - a size limit to the attached document ?

       

       

      Help would be very  appreciated

      KDE

      com.sun.xml.internal.ws.encoding.soap.DeserializationException: Failed to read a response: javax.xml.bind.UnmarshalException
      - with linked exception:
      [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,204801]
      Message: XML document structures must start and end within the same entity.]
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
      at $Proxy33.getMap2Pdf(Unknown Source)
      at client.Map2PdfClient.createPdf(Map2PdfClient.java:162)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: javax.xml.bind.UnmarshalException
      - with linked exception:
      [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,204801]
      Message: XML document structures must start and end within the same entity.]
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(Unknown Source)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
      at com.sun.xml.internal.bind.v2.runtime.BridgeImpl.unmarshal(Unknown Source)
      at com.sun.xml.internal.bind.api.Bridge.unmarshal(Unknown Source)
      at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.readResponse(Unknown Source)
      ... 28 more
      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,204801]
      Message: XML document structures must start and end within the same entity.
      at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
      at com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter.next(Unknown Source)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(Unknown Source)
      ... 32 more
        • 1. Re: [JBossWS] MTOM client parsing exception
          Karl Determe Newbie

          Okay,

           

          I got some more information when debugging. On the server side I do generate a Pdf file that has a correct syntax. But when I try to return it as a DataHandler [5] I got the Exception:

           

          com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException: java.io.IOException: LF should be proceeded by CR

           

          but instead  when I send an image [1], a zipped image [2]on client side everything is Ok.

           

          Moreover when I do zip this pdf file (as sender.zip) and I try to return it as a DataHandler [3] I got the same Exception !

           

          Anybody got an idea ?

          Help would be very appreciated...

          KDE

           

          Server side

           

          [1] File img = new File("C:\\TEMP\\image.jpg");

          [2] File img = new File("C:\\TEMP\\image.zip");

           

          [3] File img = new File("C:\\TEMP\\sender.pdf");

          [4] File img = new File("C:\\TEMP\\sender.zip");

           

          return new DataHandler(new FileDataSource(img));

           

          [5]

          ByteArrayDataSource bads = new ByteArrayDataSource(baosPDF.toByteArray(), MIMEtype);

          return new DataHandler(bads);

          (MIMEtype is "application/octet-stream")

           

          Client side

          DataHandler handler = map2Pdf.getMap2Pdf(…..);

          InputStream is = handler.getDataSource().getInputStream();

          writeToFile(is, new File("C:\\TEMP\\client.bin"));

           

           

          • 2. Re: [JBossWS] MTOM client parsing exception
            Karl Determe Newbie

            Hello,

             

            I've just discovered that everything works with a local JBoss binding address (127.0.0.1) but files are truncated when JBoss listens on my LAN IP address. Is the behavior of the JBossWS different ?

             

            Best,

            KDE

            • 3. Re: [JBossWS] MTOM client parsing exception
              Karl Determe Newbie

              Hello,

               

              I do confirm that the problem comes with the size of the attached piece. It can be an image file, a pdf file or another binary file. When I do use my IP LAN address there is an "com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException: java.io.IOException: LF should be proceeded by CR" Exception when the attached piece has a few hundreds KB size but doesn't occur when the attached piece is a few KB size.

               

              If I do use my Local IP address (127.0.0.1) things work perfectly. The problem seems not to come from firewall, network, ... and log files (org.jboss.ws.core.MessageTrace) say nothing

               

              Anybody got an idea ?

               

              Thanks !

              KDE

              • 4. Re: [JBossWS] MTOM client parsing exception
                Karl Determe Newbie

                Fixed

                 

                I should have increase the WS client runtime Heap Size

                 

                But I still don't understand why I had no Exception thrown.

                 

                Best

                KDE

                • 5. Re: [JBossWS] MTOM client parsing exception
                  Karl Determe Newbie

                  Fixed

                   

                  I should have increase the WS client runtime Heap Size

                   

                  But I still don't understand why I had no Exception thrown.

                   

                  Best

                  KDE

                  • 6. Re: [JBossWS] MTOM client parsing exception
                    Karl Determe Newbie

                    No.

                     

                    The problem is not fixed. In fact it appears from time to time and very often when the attached piece is a few hundred KB size.

                     

                    My client runtime is JDK 1.6.18. may be its runtime JAXB is incompatible with the JBoss one ?

                     

                    It looks like a bug in the WS stack …

                     

                    Best,

                    KDE

                     

                    • 7. Re: [JBossWS] MTOM client parsing exception
                      Richard Opalka Master

                      I see from your stack trace you're using JDK WS provider on client side

                      (com.sun.xml.internal.ws.encoding.soap.DeserializationException)

                      You should use JBossWS native on both client and server side.

                      Are you executing this test from IDE?

                      You should set -Djava.endorsed.dirs=$JBOSS_HOME/lib/endorsed

                      in your IDE or execution script to use JBossWS impl on client side too.

                      • 8. Re: [JBossWS] MTOM client parsing exception
                        Karl Determe Newbie

                        Thank you Richard for your suggestion,

                         

                        Yes I used to set up my Eclipse with the default JVM 1.6.18

                         

                        I have tried to add “-Djava.endorsed.dirs=C:/jboss-5.1.0/lib/endorsed” to the Default VM arguments but I have a “ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory” (however it exists in the JRE’s rt.jar runtime library). I have added  the “%JBOSS_HOME%/client” jar files as external JARS but I have a JBossWSEntityResolver NullPointerException exception.

                         

                        Any idea ? Thanks.

                        KDE