Announcement Announcement Module
Collapse
No announcement yet.
Possible for SAAJ not to use SAX? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible for SAAJ not to use SAX?

    Hello:

    I have a strange problem I'd like to solve in a creative way if possible. I'm trying to incorporate some Spring WS based services as a very small component very late in a project, so I have very limited ability to change stuff, for the sake of the imminent release.

    Basically, after getting basic authentication to work through acegi, one of my endpoints is being invoked by a Python/ZSI client program. This fails with the stack trace below. Now, I did find a solution for the problem where one must update xercesImpl.jar and xml-apis.jar in the Tomcat common/endorsed directory. I tested this, and problem solved. However, I don't have the liberty to make that kind of change at this point in the game.

    So, I thought I'd try JiBX with Stax to do the marshalling for the endpoint. But, the exception occurs while the SOAP envelope is being processed and is not endpoint specific. Is there a way to have SAAJ use a different parser implementation? Is it possible for Spring WS to use something other than SAAJ? I see a reference to Axiom, and I'll track that down. But, if that ends up using the same SAXParserFactory found in xercesImpl.jar, then that will end badly as well. Do I have to look for something other than Spring WS? Perhaps Xfire does not have this issue?

    Thanks!

    The offending stacktrace (well, most of it):
    Code:
    2007-03-26 21:33:08 StandardWrapperValve[ws-soapapi]: Servlet.service() for servlet ws-soapapi threw exception
    java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:124)
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:98)
            at com.sun.xml.messaging.saaj.util.ParserPool.get(ParserPool.java:61)
            at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:78)
            at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:71)
            at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:125)
            at org.springframework.ws.soap.saaj.Saaj13Implementation.getEnvelope(Saaj13Implementation.java:145)
            at org.springframework.ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:84)
            at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:35)
            at org.springframework.ws.soap.AbstractSoapMessage.getPayloadSource(AbstractSoapMessage.java:49)
            at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping.getMessagePayloadElement(PayloadRootQNameEndpointMapping.java:63)
            at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping.resolveQName(PayloadRootQNameEndpointMapping.java:56)
            at org.springframework.ws.server.endpoint.mapping.AbstractQNameEndpointMapping.getLookupKeyForMessage(AbstractQNameEndpointMapping.java:32)
            at org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping.getEndpointInternal(AbstractMapBasedEndpointMapping.java:107)
            at org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping.getEndpoint(AbstractEndpointMapping.java:86)
            at org.springframework.ws.server.MessageDispatcher.getEndpoint(MessageDispatcher.java:232)
            at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:185)
            at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:166)
            at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handle(WebServiceMessageReceiverObjectSupport.java:78)
            at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
            at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:386)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:355)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    ...

  • #2
    Originally posted by jas View Post
    So, I thought I'd try JiBX with Stax to do the marshalling for the endpoint. But, the exception occurs while the SOAP envelope is being processed and is not endpoint specific. Is there a way to have SAAJ use a different parser implementation?
    No, SAAJ is based on DOM, and DOM uses SAX to parse.

    Originally posted by jas View Post
    Is it possible for Spring WS to use something other than SAAJ? I see a reference to Axiom, and I'll track that down. But, if that ends up using the same SAXParserFactory found in xercesImpl.jar, then that will end badly as well.
    Yes. Just replace the SaajSoapMessageFactory with an AxiomSoapMessageFactoty, and everything should be fine. Axiom uses StAX, not SAX, so this could solve your problems.

    Comment


    • #3
      Originally posted by jas View Post
      So, I thought I'd try JiBX with Stax to do the marshalling for the endpoint. But, the exception occurs while the SOAP envelope is being processed and is not endpoint specific. Is there a way to have SAAJ use a different parser implementation?
      No, SAAJ is based on DOM, and DOM uses SAX to parse.

      Originally posted by jas View Post
      Is it possible for Spring WS to use something other than SAAJ? I see a reference to Axiom, and I'll track that down. But, if that ends up using the same SAXParserFactory found in xercesImpl.jar, then that will end badly as well.
      Yes. Just replace the SaajSoapMessageFactory with an AxiomSoapMessageFactoty, and everything should be fine. Axiom uses StAX, not SAX, so this could solve your problems.

      Comment


      • #4
        Arjen:

        Thanks for much for pointing out AxiomSoapMessageFactory. It seems to be doing the trick.

        Cheers,

        Jeff

        Comment

        Working...
        X