Can you change your route to specify the method that you would like to call and in debug mode add break at that line if (headerName == null) to see what you receive from Camel Exchange (In.body, in.headers ...) ?
<bean ref="headerBean" class="Test"/> --> <bean ref="headerBean" class="Test" method="setHeaderIfNotNull"/> NameOfTheHeader should correspond to the name of the header that you are looking for. public Class Test { public void setHeaderIfNotNull(Exchange exchange) { String headerName = exchange.getIn().getHeader("NameOfTheHeader"); if (headerName == null) { throw new RuntimeException("Impossible to set header to value: headerName is null!"); } if (value != null) { exchange.getIn().setHeader(headerName, value); } } } On Thu, Nov 28, 2013 at 9:28 AM, Claire <claire.chanm...@newgens.com.sg>wrote: > Charles, > > Thank you for reply. > > There's a file I would like to read body and specify some tag as header for > that file. I would also want to get content of that file as body. > > Following is my xml file and java in which I used exchange: > testJava.java > <http://camel.465427.n5.nabble.com/file/n5743996/testJava.java> > testRoute.xml > <http://camel.465427.n5.nabble.com/file/n5743996/testRoute.xml> > > But still no luck to use exchange to play around those content for the > file. > > Thanks, > Claire > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Using-org-apache-camel-Exchange-tp5743878p5743996.html > Sent from the Camel Development mailing list archive at Nabble.com. > -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io