That works perfectly! Thanks, Joe
On Thu, Oct 21, 2010 at 1:08 PM, Richard Kettelerij <[email protected]> wrote: > You can explicitly convert the body of an exchange using the "convertBodyTo" > DSL method (http://camel.apache.org/convertbodyto.html). Have you tried that? > > On 21 okt 2010, at 19:58, Joseph Brunner wrote: > >> Hello, >> >> I'm trying to set up a route that will FTP an XML file from a remote >> server, pass it to an XSLT processor to convert it to a CSV file, then >> FTP the CSV file up to another remote server. I had this working with >> a vanilla install of ServiceMix 4.2.0 in our test environment. It >> fails in our production environment, with the main difference being >> that the production environment uses Camel FTP 2.3.0 instead of Camel >> FTP 2.2.0. This is the error message I'm getting: >> >> 17:07:17,284 | ERROR | password=##### | DefaultErrorHandler >> | rg.apache.camel.processor.Logger 248 | Failed delivery for >> exchangeId: f14f5dec-d2bf-42cb-9348-57e4092e3bef. Exhausted after >> delivery attempt: 1 caught: >> org.apache.camel.ExpectedBodyTypeException: Could not extract IN >> message body as type: interface javax.xml.transform.Source body is: >> GenericFile[test.xml] >> org.apache.camel.ExpectedBodyTypeException: Could not extract IN >> message body as type: interface javax.xml.transform.Source body is: >> GenericFile[test.xml] >> >> With TRACE logging turned on, I can see the contents of the XML file >> so I know it is being properly downloaded. It seems like the XSLT >> processor does not know how to convert the XML file input into a >> Source object. Here is the route that I'm using: >> >> <camel:route> >> <camel:from >> uri="ftp://##...@#######/?password=######&passiveMode=true&binary=false&delay=6000&filter=#myfilter"/> >> <camel:to uri="xslt:test-csv.xsl"/> >> <camel:setHeader headerName="CamelFileName"> >> >> <camel:simple>${file:name.noext}.${date:now:yyyy-MM-dd-hh.mm.ss}.csv</camel:simple> >> </camel:setHeader> >> <camel:to >> uri="ftp://#...@####:###/?password=####&passiveMode=true&binary=false&disconnect=true"/> >> </camel:route> >> >> The #myfilter URL parameter is selecting the file to download by >> filename. This is working properly in both environments. In the test >> environment where it was working, I had added this processor >> immediately after the 'from' ftp component, before the XSLT processor: >> >> <camel:setBody> >> <camel:simple>${body}</camel:simple> >> </camel:setBody> >> >> This setBody processor sets the body of the message to the contents of >> the file, which allowed the XSLT processor to properly process the >> file's contents in the test environment. However, in my production >> environment the setBody processor does not seem to fix this error. >> >> I've tried writing a couple of Converters to convert a GenericFile to >> a Source and also to a String, and also to convert a File to a Source >> and a String but none of those seem to ever get called. >> >> Any help would be appreciated. Thanks in advance, >> Joe Brunner > >
