0 Replies Latest reply on Aug 7, 2012 8:52 AM by António Ribeiro

    Retrieve SOAPMessage from WrappedMessageContext using SOAPMessageContextImpl, in JBoss 6.1

    António Ribeiro Newbie

      Hey guys,

       

      I don't know if the subject of the discussion is clear enough but I'll do my best to explain what is happening.

       

      I've a web service deployed into JBoss 6.1 and I'm trying to retrieve the SOAPMessage (javax.xml.ws) from my WebServiceContext (javax.xml.ws).

       

      @Resource
      private WebServiceContext wsctx;
      

       

      The thing is that, in JBoss 6.1, we no longer are able to do what, for instance, one could do in JBoss 5.1. In JBoss 5.1, to attain the SOAPMessage we could do the following:

       

      SOAPMessageContext msgContext = (SOAPMessageContext) wsctx.getMessageContext();
      SOAPMessage soapMessage = msgContext.getMessage();
      

       

      Now, in JBoss 6.1, the SOAPMessageContext is no longer supported hence, and according to what is available throughout the Web, one has to do the following:

       

      WrappedMessageContext wmc = (WrappedMessageContext) wsctx.getMessageContext();
      Message message = wmc.getWrappedMessage();
      SOAPMessageContextImpl smci = new SOAPMessageContextImpl(message);
      SOAPMessage soapMessage = smci.getMessage();
      

       

      The problem is that, when doing smci.getMessage(); it is returned a org.w3c.dom.DOMException saying WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.

       

      Can you please enlighten me in what I'm doing wrong?

       

      Grateful for your attention.

       

      Best regards