Hi

If you use getMandatoryBody then Camel will throw an exception if it
cannot convert to the given type.


On Mon, Nov 21, 2011 at 10:21 PM, Castyn <eric.ben...@gmail.com> wrote:
> 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.
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Custom-Processor-with-XPath-tp5011728p5011728.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to