1 Reply Latest reply on Mar 7, 2011 12:09 PM by Branislav Milojkovic

    Editing an outbound soap message

    Branislav Milojkovic Newbie

      Hi all,

      I have a need to intercept an outbound SOAPMessage and add some info to it (used to sign the request).


      I am using JBoss version 4.2.3. I get the following exception



      Caused by: org.jboss.util.NotImplementedException: setTextContent

          at org.jboss.ws.core.soap.NodeImpl.setTextContent(NodeImpl.java:652)



      When invoking the second line from this piece of code:



      Element element = node.getOwnerDocument().createElement(elementName);





      Now, if i do this in a non-ejb project, the SOAPMessage instance is one from appache-commons and that works fine, since tracking down the node I need leads me to appache implementation of the Node interface, which happens to have the setTextContent method not throw an exception.


      Now, two solutions that come to my mind is

      1) There is another way to modify an outbound SOAPMessage that I am not aware of (*crosses fingers*)

      2) Somehow disable SOAP handling from JBoss, which will hopefully result in appache handling it.


      Ideas? Hope I'm not giving too few details, I just don't want this message to be any longer than it needs to. (:


      Kind regards,


        • 1. Editing an outbound soap message
          Branislav Milojkovic Newbie

          I have found a solution. The thing was to use this bit of code for editing SOAP


          SOAPFactory factory = SOAPFactory.newInstance();

          SOAPElement signatureElement = factory.createElement("Signature");




          in stead of this:

          Element element = firstChild.getOwnerDocument().createElement("Signature");




          Apparently, the second version will work with appache-commons, but not with JBoss for some reason. Hope this helps someone.