Announcement Announcement Module
Collapse
No announcement yet.
Namespace Issue with CXF client calling Spring Web Service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Namespace Issue with CXF client calling Spring Web Service

    I've run into an issue with my Spring Web Service with one particular external client.

    The problematic client calling the service is using CXF/Jaxb.

    The issue is with multiple namespaces in the soap body. The endpoint cannot handle them when one of them is a defaultns:

    i.e. something like this works fine
    (I had to pull the http from the soapenv and xmlns elements because the forums would not allow them in the post)

    <soapenv:Envelope xmlns:soapenv="h ttp ://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <test1:Order xmlns:test1=."h ttp ://my.company.com/types/OrderRequest"
    xmlns:test2="my.company.com/types/OrderResponse">
    <test1:Item>1234</test1:Item>
    </test1:Order>

    but the cxf client is generating a request like this:
    <soapenv:Envelope xmlns:soapenv="http ://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <test1:Order xmlns:test1="http ://my.company.com/types/OrderRequest"
    xmlns="http ://my.company.com/types/OrderResponse">
    <test1:Item>1234</test1:Item>
    </test1:Order>

    which returns the error/stacktrace below (apologies for the hideously long stracktrace):

    Any suggestions? I'm extending AbstractDom4jPayloadEndpoint, but the same issue occurred using other endpoint types as well.

    14:50:19,174 WARN [SoapMessageDispatcher] Endpoint invocation resulted in exception - responding with SOAP Fault
    org.springframework.ws.soap.saaj.SaajSoapEnvelopeE xception: Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
    Caused by:
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
    at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:114)
    at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1 Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java :71)
    at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEn velope(SOAPPartImpl.java:125)
    at org.springframework.ws.soap.saaj.Saaj13Implementat ion.getEnvelope(Saaj13Implementation.java:169)
    at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:86)
    at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:36)
    at org.springframework.ws.soap.AbstractSoapMessage.ge tPayloadSource(AbstractSoapMessage.java:46)
    at org.springframework.ws.server.endpoint.mapping.Pay loadRootAnnotationMethodEndpointMapping.getLookupK eyForMessage(PayloadRootAnnotationMethodEndpointMa pping.java:57)
    at org.springframework.ws.server.endpoint.mapping.Abs tractMethodEndpointMapping.getEndpointInternal(Abs tractMethodEndpointMapping.java:55)
    at org.springframework.ws.server.endpoint.mapping.Abs tractEndpointMapping.getEndpoint(AbstractEndpointM apping.java:83)
    at org.springframework.ws.server.MessageDispatcher.ge tEndpoint(MessageDispatcher.java:242)
    at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:195)
    at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:162)
    at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:87)
    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:197)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:441)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:174)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:874)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:449)
    at com.sun.xml.messaging.saaj.util.transform.Efficien tStreamingTransformer.transform(EfficientStreaming Transformer.java:390)
    at com.sun.xml.messaging.saaj.s

  • #2
    FYI: I am using maven2 and including xalan 2.7.0 and xerces 2.8.1 in my web-inf/lib.

    This rrror happens under tomcat, jboss, and websphere (and yes, I use the suggested classloader config for websphere due to it using older versions of these jars).

    Comment

    Working...
    X