Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-688

Unable to handle Exception when endpoint invoked with invalid XML

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0 M3, 2.0 RC1, 2.0 RC2, 2.0 GA
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
      None

      Description

      When an endpoint is invoked with invalid XML, it is not possible to catch the resulting WebServiceMessageException that is thrown, using some sort of EndpointExceptionResolver.

      It would be nice to be able to provide a very basic, friendly error message response, rather this exception running up the stack and returning a stack trace that isn't XML.

      An example stack trace from this issue is

      org.springframework.ws.soap.saaj.SaajSoapEnvelopeE xception: Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Unable to create envelope from given source:
      at org.springframework.ws.soap.saaj.SaajSoapMessage.g etSaajVersion(SaajSoapMessage.java:260)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.g etImplementation(SaajSoapMessage.java:342)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.& lt;init>(SaajSoapMessage.java:117)
      at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:184)
      at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:58)
      at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:90)
      at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:86)
      at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:57)
      at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:222)
      at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644)
      at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:560)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler.handle(Se rvletHandler.java:390)
      at org.mortbay.jetty.security.SecurityHandler.handle( SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(Se ssionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(Co ntextHandler.java:765)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebA ppContext.java:418)
      at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:327)
      at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:126)
      at org.tuckey.web.filters.urlrewrite.NormalRewrittenU rl.doRewrite(NormalRewrittenUrl.java:195)
      at org.tuckey.web.filters.urlrewrite.RuleChain.handle Rewrite(RuleChain.java:159)
      at org.tuckey.web.filters.urlrewrite.RuleChain.doRule s(RuleChain.java:141)
      at org.tuckey.web.filters.urlrewrite.UrlRewriter.proc essRequest(UrlRewriter.java:90)
      at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter .doFilter(UrlRewriteFilter.java:417)
      at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
      [...trimmed...]
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run (QueuedThreadPool.java:582)
      Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Unable to create envelope from given source:
      at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:114)
      at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:70)
      at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:122)
      at org.springframework.ws.soap.saaj.support.SaajUtils .getSaajVersion(SaajUtils.java:155)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.g etSaajVersion(SaajSoapMessage.java:257)
      ... 42 more
      Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
      at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:502)
      at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:393)
      at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
      ... 46 more
      Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
      at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterI mpl.java:333)
      at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:485)
      ... 48 more</pre>
      <h3>Caused by:</h3>
      <pre>com.sun.xml.internal.messaging.saaj.SOAPExcep tionImpl: Unable to create envelope from given source:
      at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:114)
      at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:70)
      at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:122)
      at org.springframework.ws.soap.saaj.support.SaajUtils .getSaajVersion(SaajUtils.java:155)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.g etSaajVersion(SaajSoapMessage.java:257)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.g etImplementation(SaajSoapMessage.java:342)
      at org.springframework.ws.soap.saaj.SaajSoapMessage.& lt;init>(SaajSoapMessage.java:117)
      at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:184)
      at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:58)
      at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:90)
      at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:86)
      at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:57)
      at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:222)
      at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644)
      at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:560)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:511)
      [...trimmed...]
      at org.mortbay.io.nio.SelectChannelEndPoint.run(Selec tChannelEndPoint.java:410)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run (QueuedThreadPool.java:582)
      Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
      at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:502)
      at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:393)
      at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
      ... 46 more
      Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
      at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterI mpl.java:333)
      at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:485)
      ... 48 more

        Issue Links

          Activity

          Hide
          m.andrew Andrey Moiseenko added a comment -

          Seems like duplicate of SWS-671

          Show
          m.andrew Andrey Moiseenko added a comment - Seems like duplicate of SWS-671

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              tedpennings Ted Pennings
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: