Page 1 of 3 123 LastLast
Results 1 to 10 of 26

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

  1. #1

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    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?
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    May 2007
    Posts
    17

    Default 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

  4. #4
    Join Date
    May 2007
    Posts
    17

    Default 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

  5. #5
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

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

    Thanks for the investigation!
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  6. #6
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    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?
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  7. #7
    Join Date
    Sep 2007
    Posts
    3

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

  8. #8
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

  9. #9
    Join Date
    Sep 2004
    Posts
    602

    Default

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

  10. #10
    Join Date
    Sep 2007
    Posts
    3

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •