2 Replies Latest reply on Mar 5, 2006 8:42 AM by Thomas Diesler

    SOAPHandler Question

    Chris Baxter Newbie

      I'm currently using JBoss 4.0.3SP1 with W24EE as my SOAP Stack. We re-did our webservices structure and implementation here to use W24EE as oppose to our older and more proprietary approach. Unfortunately, we still need to handle the old message formats for some period. My thought for solving this problem was to use SOAPHandlers to intercept the request and response and re-format if it's the old message type. So, to test out how this works, I created an extension of GenericHandler and configured it in my webservices.xml. I tested the initial implementation to make sure that it was at least being called and it was. Next, I added a little more test logic to the handleRequest method to get the incoming parameter (a Long) and change it's value. The method looks like this:

      public boolean handleRequest(MessageContext ctx) {
       System.out.println("In handle request-------------");
       org.jboss.axis.MessageContext axisCtx = (org.jboss.axis.MessageContext)ctx;
       Message m = axisCtx.getCurrentMessage();
       try {
       SOAPElementAxisImpl envelope = m.getSOAPEnvelope();
       Document doc = envelope.getAsDocument();
       Element env = (Element)doc.getChildNodes().item(0);
       Node body = env.getChildNodes().item(3);
       Node methodName = body.getChildNodes().item(1);
       Node param1 = methodName.getChildNodes().item(1);
       Node valNode = param1.getFirstChild();
       System.out.println("Value: " + valNode.getNodeValue());
       System.out.println("New Value: " + valNode.getNodeValue());
       catch (AxisFault e) {
       return true;

      But after testing this logic, I could see that the parameter value was not being changed when the call made it to my Java Service Endpoint. Am I doing something wrong here? What can I do to ensure that the changes to the incoming SOAP XML actually take effect?