Updating the CXF version to 2.7.4 partly fixed the issue. Then i need to
Update my interceptor code as following to resolve this issue . The solution
is well explained in this link:

public class TestOutInterceptor extends AbstractSoapInterceptor {
    private static Logger logger = LoggerFactory
        .getLogger(EnterpriseServiceMonitoringOutInterceptor.class);
    private SAAJOutInterceptor saajOut = new SAAJOutInterceptor();




    public TestOutInterceptor() {
    super(Phase.PRE_PROTOCOL);
    getAfter().add(SAAJOutInterceptor.class.getName());
    // TODO Auto-generated constructor stub
    }

    @Override
    public void handleMessage(SoapMessage soapMessage) throws Fault {
    getSOAPMessage(soapMessage);
        //add the ending interceptor to do the work
    soapMessage.getInterceptorChain().add(new EndingInterceptor());
    }



    private SOAPMessage getSOAPMessage(SoapMessage smsg){

        SOAPMessage soapMessage = smsg.getContent(SOAPMessage.class);

    if (soapMessage == null) {



        saajOut.handleMessage(smsg);

        soapMessage = smsg.getContent(SOAPMessage.class);

    }   

    return soapMessage;

  }

    static class EndingInterceptor extends AbstractSoapInterceptor {

    private SAAJOutEndingInterceptor saajOutEnding = new
SAAJOutEndingInterceptor();
        public EndingInterceptor() {
             super(Phase.PRE_PROTOCOL_ENDING);
             addBefore(SAAJOutEndingInterceptor.class.getName()); 
         }
        public void handleMessage(SoapMessage soapMessage) throws Fault { 
            ServiceData serviceData=(ServiceData)
soapMessage.getExchange().remove("esmServiceData");
        System.out.println("Test");
        System.out.println(soapMessage.getInterceptorChain());

        SOAPMessage soapMessagexml = getSOAPMessage(soapMessage);
        if(serviceData!=null){
            serviceData.setResponseTime(new BigDecimal((new
Date()).getTime()));

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            try {
            soapMessagexml.writeTo(out);
            String strMsg = new String(out.toByteArray());
             serviceData.setResponsePayload(strMsg);
             logger.debug(strMsg);
            } catch (SOAPException e) {
            logger.error("", e);
            } catch (IOException e) {
            logger.error("", e);
            }

        }
        }

        private SOAPMessage getSOAPMessage(SoapMessage smsg){

            SOAPMessage soapMessage = smsg.getContent(SOAPMessage.class);

        if (soapMessage == null) {



            saajOutEnding .handleMessage(smsg);

            soapMessage = smsg.getContent(SOAPMessage.class);

        }   

        return soapMessage;

      }
   } 

}



--
View this message in context: 
http://cxf.547215.n5.nabble.com/org-w3c-dom-DOMException-HIERARCHY-REQUEST-ERR-An-attempt-was-made-to-insert-a-node-where-it-is-not-d-tp5729455p5729462.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to