Announcement Announcement Module
Collapse
No announcement yet.
org.xml.sax.SAXParseException: The root element is required in a well-formed document Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.xml.sax.SAXParseException: The root element is required in a well-formed document

    I'm getting the following error on WebSphere 6.1 running Spring WS RC2:

    Code:
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG web.servlet.DispatcherServlet - DispatcherServlet with name 'spring-ws' received request for [/mws/services/ListCodeValues]
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG web.servlet.DispatcherServlet - Bound request context to thread: com.ibm.ws.webcontainer.srt.SRTServletRequest@3cba3cba
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG web.servlet.DispatcherServlet - Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@36ea36ea] in DispatcherServlet with name 'spring-ws'
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG servlet.handler.SimpleUrlHandlerMapping - Looking up handler for[/ListCodeValues]
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG web.servlet.DispatcherServlet - Testing handler adapter [org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter@17d617d6]
    [6/21/07 17:44:49:486 EDT] 00000027 SystemOut     O 2007-06-21 17:44:49,486 [] DEBUG web.servlet.DispatcherServlet - Testing handler adapter [org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter@2dc42dc4]
    [6/21/07 17:45:01:704 EDT] 00000027 SystemOut     O 2007-06-21 17:45:01,704 [] DEBUG soap.server.SoapMessageDispatcher - MessageDispatcher with name 'messageDispatcher' received request [SaajSoapMessage]
    [6/21/07 17:45:36:574 EDT] 00000027 SystemOut     O 2007-06-21 17:45:36,574 [] DEBUG soap.server.SoapMessageDispatcher - Testing endpoint exception resolver [org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver@780078]
    [6/21/07 17:45:36:654 EDT] 00000027 SystemOut     O 2007-06-21 17:45:36,574 [] WARN  soap.server.SoapMessageDispatcher - Endpoint invocation resulted in exception - responding with SOAP Fault
    org.springframework.ws.soap.saaj.SaajSoapEnvelopeException: Could not access envelope: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: ; nested exception is javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: 
    Caused by: 
    javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: 
    	at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:638)
    	at org.springframework.ws.soap.saaj.Saaj12Implementation.getEnvelope(Saaj12Implementation.java:140)
    	at org.springframework.ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:81)
    	at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:35)
    	at org.springframework.ws.soap.AbstractSoapMessage.getPayloadSource(AbstractSoapMessage.java:45)
    	at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping.resolveQName(PayloadRootQNameEndpointMapping.java:55)
    	at org.springframework.ws.server.endpoint.mapping.AbstractQNameEndpointMapping.getLookupKeyForMessage(AbstractQNameEndpointMapping.java:32)
    	at org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping.getEndpointInternal(AbstractMapBasedEndpointMapping.java:105)
    	at org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping.getEndpoint(AbstractEndpointMapping.java:82)
    	at org.springframework.ws.server.MessageDispatcher.getEndpoint(MessageDispatcher.java:237)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:190)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:157)
    	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
    	at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:972)
    	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    	at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    	at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
    	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
    	at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
    	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
    	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
    	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
    	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
    	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
    	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
    	at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
    	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
    	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
    	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
    	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
    Caused by: 
    org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: 
    	at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:206)
    	at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1062)
    	at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:604)
    	at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:632)
    	... 39 more
    Caused by: 
    org.xml.sax.SAXParseException: The root element is required in a well-formed document.
    	at com.ibm.xml.xlxp.api.sax.impl.SAX2ParserBase.reportFatalError(SAX2ParserBase.java:440)
    	at com.ibm.xml.xlxp.api.was.WSXMLReader$WSScannerHelper.produceFatalErrorEvent(WSXMLReader.java:468)
    	at com.ibm.xml.xlxp.api.util.SimpleScannerHelper.reportFatalError(SimpleScannerHelper.java:1293)
    	at com.ibm.xml.xlxp.scan.DocumentEntityScanner.scanProlog(DocumentEntityScanner.java:1669)
    	at com.ibm.xml.xlxp.scan.DocumentEntityScanner.produceEvent(DocumentEntityScanner.java:574)
    	at com.ibm.xml.xlxp.scan.DocumentEntityScanner.produceEvents(DocumentEntityScanner.java:600)
    	at com.ibm.xml.xlxp.scan.DocumentEntityScanner.parseDocumentEntity(DocumentEntityScanner.java:422)
    	at com.ibm.xml.xlxp.api.util.SimpleScannerHelper.parseDocumentEntity(SimpleScannerHelper.java:184)
    	at com.ibm.xml.xlxp.api.was.WSXMLReader.parseEvents(WSXMLReader.java:117)
    	at com.ibm.xml.xlxp.api.sax.impl.SAX2ParserBase.parseEntity(SAX2ParserBase.java:1013)
    	at com.ibm.xml.xlxp.api.sax.impl.SAX2ParserBase.parse(SAX2ParserBase.java:1051)
    	at javax.xml.parsers.SAXParser.parse(Unknown Source)
    	at com.ibm.ws.webservices.engine.utils.WebServicesParser.parse(WebServicesParser.java:340)
    	at com.ibm.ws.webservices.engine.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:269)
    	at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1036)
    	... 41 more
    Here is my SOAP message request:
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ListCodeValues/1.0">
       <soapenv:Header/>
       <soapenv:Body>
          <ns:ListCodeValuesRequest>
             <ns:UserId>skendr</ns:UserId>
             <ns:Password>tester78</ns:Password>
             <ns:CodeCategory>BU</ns:CodeCategory>
          </ns:ListCodeValuesRequest>
       </soapenv:Body>
    </soapenv:Envelope>
    Any ideas?
    Thanks in advance,
    Shannon Kendrick

  • #2
    I have no idea. Is this the first time you've deployed to WebSphere, or did you try it before (using RC1 or earlier) successfully?

    Comment


    • #3
      Same problem in WAS 6.0

      I have the same problem in WAS 6.0.2.15, seems to me that it is due to the saaj implementation of WAS. Is there another way of parsing the soap message instead of saaj?

      btw, isn't WAS 6.1 java 5 ? You can then run the sun saaaj impl (that is also used in the examples) and use the PARENT_LAST loader to ensure that it is loaded before the ibm implementation..

      Anyone else succesfully running this on WAS

      rgds

      Joost

      Comment


      • #4
        Problem found

        I have found the problem:

        Axis1 (and I believe this is what the core saaj implementation of websphere is based on) caches the InputStream for later use.

        When calling the MessageFactory.createMessage(mimeHeaders,InputStre am) the implementation of Axis1 (and websphere) caches the inputstream.

        In AbstractWebServiceConnection.receive however, the inputstream is closed after creating the message. Causing Axis to lose the message contents and thus a SAXParseException later on in the process

        I have implemented my own version of the MessageFacroryImpl that convert the inputstream to a byte[].. Hopefully this problem can be solved within Spring-WS.. Maybe not closing the InputStream?

        Hope this helps

        rgds

        Joost

        Comment


        • #5
          I've created SWS-150, which will be fixed for 1.0.

          Thanks for the investigation!

          Comment


          • #6
            It's fixed. Unfortunately, I could not reproduce it, but at least the ServletInputStream is not closed anymore in AbstractWebServiceConnection.receive().

            Could you try one of the nighly builds starting tomorrow and see whether it works?

            Comment


            • #7
              The root element is required in a well-formed document. Message being parsed

              On websphere 6.1.0.9, we are getting this error:

              MSG:<Could not access envelope: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: ; nested exception is javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: >

              org.springframework.ws.soap.client.SoapFaultClient Exception: Could not access envelope: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: ; nested exception is javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed:

              at org.springframework.ws.soap.client.core.SoapFaultM essageResolver.resolveFault(SoapFaultMessageResolv er.java:36)

              at org.springframework.ws.client.core.WebServiceTempl ate.handleFault(WebServiceTemplate.java:528)

              at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:411)

              at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 265)

              at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 253)

              Is this caused by the same reason as the above posts, if so, how can we get a copy of the nighly build of 1.0.1-SNAPSHOT. We can't get it from the Spring site.

              Comment


              • #8
                See http://static.springframework.org/sp...snapshots.html

                Comment


                • #9
                  Originally posted by java123 View Post
                  On websphere 6.1.0.9, we are getting this error:

                  MSG:<Could not access envelope: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: ; nested exception is javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: >
                  This is just saying that the server couldn't parse the XML - there may in fact be nothing wrong with the XML at all. Check your server logs rather than the client ones, I've often found the problem being due to missing jar files on the server.

                  Comment


                  • #10
                    The root element is required in a well-formed document. Message being parsed

                    Thanks for all of your responses. We changed to use Spring-ws 1.0.0 which fixed the problem.

                    Comment


                    • #11
                      Same problem

                      Greetings!

                      I am stuck with this very same problem.
                      Using WAS 6.1.0.9 (JDK compliance 5.0) and spring-ws-1.0.2.

                      The server logs are just like mskendrick reports them.

                      Any tips or recommendations will be greatly appreciated.
                      Thanks.

                      Comment


                      • #12
                        same problem

                        We were using Spring-WS RC2 when we had the problem. The problem seems to be gone with Spring-WS 1.0.0.

                        Comment


                        • #13
                          Nothing budged

                          I just dowloaded and used Spring-WS 1.0.0 (vs. Spring-WS 1.0.2 i have been using)

                          It did not change anything.

                          You didn't play with the saaj-api.jar (s) by any chance as jwijgerd mentions?

                          Thanks very much for your reply!

                          Comment


                          • #14
                            Same thing happening for me too

                            I am running into the exact same error when running under JRE 1.4 as a spring-ws client hitting my spring-ws 1.0.2 web service running under JRE 1.5 with Tomcat 5.5.

                            When I use SoapUI (jre 1.5) as a client, everything works great but when I try using my JRE 1.4 client it bombs out with the same error.

                            Switching from spring-ws 1.0.2 to spring-ws 1.0.0 in my JRE 1.4 client made absolutely no difference at all, still getting the same error.

                            Does anyone know how to fix this?

                            Comment


                            • #15
                              Further details

                              Hello again.

                              jgoober: is your client running in Websphere, and if so which version?

                              My response soap is fine as per gsoap server (web service) logs. Besides, the rq/rs round trip (from my client to the server) works well when using the RAD WSDL2Java tool to generate the binding classes and proxy code. But when I use spring-ws-1.0.2 and xml-beans-2.3.0 instead the above error happens with the response payload.

                              I know Arjen and others mentioned potential issues with app server vendor SAAJ implementations so i tried to override the saaj jars with no luck. I took me a while just to locate the 1.2 versions and at the end the VM did not react kindly.

                              So I went the Axiom route but i am getting this (for the outbound request):
                              Local name may not be null or empty
                              java.lang.IllegalArgumentException: Local name may not be null or empty
                              at org.apache.axiom.om.impl.llom.OMAttributeImpl.<ini t>(OMAttributeImpl.java:52)
                              at org.apache.axiom.om.impl.llom.OMElementImpl.addAtt ribute(OMElementImpl.java:532)
                              at org.apache.axiom.om.impl.builder.SAXOMBuilder.star tElement(SAXOMBuilder.java:111)
                              at org.apache.xmlbeans.impl.store.Saver$SaxSaver.emit Element(Saver.java:3363)
                              at org.apache.xmlbeans.impl.store.Saver.processElemen t(Saver.java:456)
                              at org.apache.xmlbeans.impl.store.Saver.process(Saver .java:307)
                              at org.apache.xmlbeans.impl.store.Saver$SaxSaver.<ini t>(Saver.java:3280)
                              at org.apache.xmlbeans.impl.store.Cursor._save(Cursor .java:559)
                              at org.apache.xmlbeans.impl.store.Cursor.save(Cursor. java:2508)
                              at org.apache.xmlbeans.impl.values.XmlObjectBase.save (XmlObjectBase.java:174)
                              at org.springframework.oxm.xmlbeans.XmlBeansMarshalle r.marshalSaxHandlers(XmlBeansMarshaller.java:110)
                              at org.springframework.oxm.AbstractMarshaller.marshal SaxResult(AbstractMarshaller.java:231)
                              at org.springframework.oxm.AbstractMarshaller.marshal (AbstractMarshaller.java:94)
                              at org.springframework.ws.support.MarshallingUtils.ma rshal(MarshallingUtils.java:84)
                              at org.springframework.ws.client.core.WebServiceTempl ate$1.doWithMessage(WebServiceTemplate.java:267)
                              Cheers.

                              Comment

                              Working...
                              X