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

Soap headers with whitespace cause java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.impl.TextImpl

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.2
    • Fix Version/s: 1.5 M1, 1.0.3
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Spring WS 1.0.2, Sun's SAAJ 1.2

      Description

      Soap headers that contain whitespace between xml elements result in ClassCastExceptions when using Sun's SAAJ 1.2 jar (I'm using Sun's 1.1 soap message factory "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"). If you remove the whitespace between the xml elements on the Soap header on the request, the ClassCastException goes away.

      The error is caused by the following code that assumes all nodes returned back are SOAPHeaderElement instances but the whitespace nodes are returned back as com.sun.xml.messaging.saaj.soap.impl.TextImpl instances.

      org.springframework.ws.soap.saaj.SaajSoap11Header

      public Iterator examineHeaderElementsToProcess(String[] actors) {
      List result = new ArrayList();
      Iterator iterator = getImplementation().examineAllHeaderElements(getSaajHeader());
      while (iterator.hasNext()) {
      SOAPHeaderElement saajHeaderElement = (SOAPHeaderElement) iterator.next(); <- class cast happens here

      Here's the stack trace:

      java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.impl.TextImpl
      at org.springframework.ws.soap.saaj.SaajSoap11Header.examineHeaderElementsToProcess(SaajSoap11Header.java:46)
      at org.springframework.ws.soap.server.SoapMessageDispatcher.handleHeaders(SoapMessageDispatcher.java:108)
      at org.springframework.ws.soap.server.SoapMessageDispatcher.handleRequest(SoapMessageDispatcher.java:92)
      at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:199)
      at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:162)
      at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:87)
      at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
      at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arjen.poutsma Arjen Poutsma
                Reporter:
                lafondoo Mark LaFond
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: