1 Reply Latest reply on Nov 22, 2011 3:43 AM by davsclaus

    Custom Processor

    gt6081a

      I am attempting to convert a SOAP message from one message format to another, and along the way calculating and aggregating data.  At any rate, I am trying to create a custom processor to do this, within which I will have xpath calls and such.

       

      Currently I am running into an issue trying to convert the message into a org.w3c.dom.Document format for me to use XPath against, and it seems that when I try to

       

      import org.apache.camel.Exchange;
      import org.apache.camel.Processor;
      import org.w3c.dom.*;
      
      public class HotelProcessor implements Processor {
      
           public void process(Exchange exchange) throws Exception {
                Document payload = exchange.getIn().getBody(Document.class);
      
                      // XPath stuff to go here
      
                      exchange.getIn().setBody(payload.toString());  // Just temp for testing
           }
      }
      

       

      The payload becomes empty as the next step in the route is a null message.  Any idea what I am doing wrong, or is there a different way I would want to do this all together?  When I use getBody with String.class instead everything works fine, but I can't perform xpath on the payload if I do that.