Hi Please use the @user mailing list to ask this kind of question.
And the error is not strange, you need load the file into memory if you want to work on the message body, eg from(...) .convertBodyTo(String.class) On Sun, Feb 21, 2016 at 8:16 PM, souciance <souciance.eqdam.ras...@gmail.com> wrote: > Hi, > > I am writing a very basic camel flow to test using scripts. But it gives me > a strange error. The route looks like this: > > The main action happens here: > from("file://C:test?fileName=in.xml").routeId("ContentbasedRouter") > .choice() > .when(toXML) > .script().javaScript("request.body.substring(3, 6)") > > But when I run this I get > org.apache.camel.builder.script.ScriptEvaluationException: Failed to > evaluate: js: request.body.substring(3, 6). Cause: <eval>:1 TypeError: > GenericFile[C:\test\input.csv] has no such function "substring" > > I have tried with script().groovy() but gives me similar error groovy > missingmethod. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-script-gives-strange-error-tp5778017.html > Sent from the Camel Development mailing list archive at Nabble.com. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2