Hi, If you don't mind using XQuery as an expression language for achieving this, you could use the following instead of using a Bean. IMHO, this is more natural, as it uses XML languages themselves to spit out an XML-compliant dateTime format ;)
<setHeader headerName="myDate"> <xquery type="java.lang.String" xmlns:xs=" http://www.w3.org/2001/XMLSchema">xs:dateTime(current-dateTime()) - xs:dayTimeDuration('P1D')</xquery> </setHeader> Couple of things: - Providing the type is absolutely necessary (java.lang.String in the above example) - You need to specify the XML Schema namespace. If you want the expression XML element to be lighter, you could push up the namespace declaration to the <route>, <camelContext> element or above - You can construct the duration dynamically by using the concat() function. - Make sure that camel-saxon is on your classpath, or that the camel-saxon feature is installed if you are using ServiceMix/Karaf - whatever is relevant in your case. Hope this helps. Regards, Raúl. On 7 December 2011 16:00, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Wed, Dec 7, 2011 at 4:47 PM, Castyn <eric.ben...@gmail.com> wrote: > > So if I declared a bean with id of getLastRunDate that returned a string > of > > the appropriate date format, how do you actually call that in the Spring > DSL > > to set a header? > > > > Use the method call expression, something a like this: > > <setHeader headerName="myDate"> > <method ref="myBean" method="getLastRunDate"/> > </setHeader> > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/Date-String-Creation-tp5052753p5056060.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/ >