Question

I'm using JAX-WS in a stateless bean exposed as a web service using Spring configuration (not Spring-WS). I've added a SOAP Handler and in handler, when I try to getMessage() on the SOAPMessageContext, I get a An attempt was made to insert a node where it is not permitted.

        at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:
224)
        at org.apache.axiom.om.impl.dom.NodeImpl.appendChild(NodeImpl.java:240)
        at org.apache.axis2.saaj.SOAPPartImpl.appendChild(SOAPPartImpl.java:989)

        at com.sun.xml.bind.marshaller.SAX2DOMEx.startElement(SAX2DOMEx.java:198
)
        at com.sun.xml.ws.message.SAX2DOMWriterEx.writeStartElement(SAX2DOMWrite
rEx.java:97)
        at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImp
l.java:144)
        at com.sun.xml.ws.message.AbstractMessageImpl.readAsSOAPMessage(Abstract
MessageImpl.java:226)
        at com.sun.xml.ws.handler.SOAPMessageContextImpl.getMessage(SOAPMessageC
ontextImpl.java:87)

I added these dependencies to my Maven configuration: JAX-WS: Getting DOMException - HIERARCHY_REQUEST_ERR upon trying to add security headers

I've read that the WebLogic saaj libraries are out of date. I tried adding this to my startup environment script:

-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl

and also tried:

-Djavax.xml.soap.MessageFactory=org.springframework.ws.soap.axiom.AxiomSoapMessageFactory

but that hasn't helped.

Was it helpful?

Solution

It turns out that this class using Axis2 is problematic. I removed all dependencies and references to Axis2 and now the application uses Sun's version of saaj which works without a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top