Hi You can add a convertBodyTo to force Camel to load your file and let the payload be a well known type the XPath can work with.
Must obvious is to convert it to a String. So after the from() or just before the xpath you can do: .convertBodyTo(String.class) In Spring DSL its <convertBodyTo type="java.lang.String"/> On Mon, Jun 1, 2009 at 11:44 AM, Andii <[email protected]> wrote: > > I'm new in Camel. > I want to use content message router to process a message in different ways > depending on data in message header. Input message countains in body user > defined (my) type (com.my.defined.type.Document). Before sending that > message as input to router I put some new data into header which are used by > router to decide where the message should be passed (for example > document.file.size). I have following configuration: > > <from uri="file://inbox/upload-file-simple" /> > <to uri="bean:documentCreator?methodName=createDocumentFromFile" /> > <to uri="bean:documentProcessor?methodName=putRequiredDataToMsgHeader" /> > <choice> > <when> > <xpath>in:header('document.file.size') > 20000</xpath> > <to uri="bean:someOtherBean1?methodName=name" /> > </when> > <otherwise> > <to uri="bean:someOtherBean2?methodName=name" /> > </otherwise> > </choice> > > But when I try run that example I see following error > > 10:39:19,365 | ERROR | compon...@674e9b | DeadLetterChannel | > org.apache.camel.processor.Logger 203 | Failed delivery for exchangeId: > ID-host/40757-1243842719103/0-12. On delivery attempt: 0 caught: > org.apache.camel.NoTypeConversionAvailableException: No type converter > available to convert from type: class > org.apache.camel.component.file.FileMessage to the required type: > org.w3c.dom.Document with value FileMessage: > inbox/upload-file-simple/MyFile.pdf > org.apache.camel.NoTypeConversionAvailableException: No type converter > available to convert from type: class > org.apache.camel.component.file.FileMessage to the required type: > org.w3c.dom.Document w > ith value FileMessage: inbox/upload-file-simple/MyFile.pdf > > > I guess that error may occur because message body is not a text (XML). If > it's true what should I do ? Use other EIP pattern ?? Or maybe put my object > to exchange attachement and leave empty body ? > > Many thanks for help > Andrzej > > -- > View this message in context: > http://www.nabble.com/Content-message-router-conversion-exception-tp23811650p23811650.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
