You are looking for something like: .process(new Processor() { public void process(Exchange exchange) throws Exception { Map map = exchange.getIn().getBody(Map.class); String entry = (String) map.get("KEY"); MyJaxbObject object = exchange.getContext().getTypeConverter().convertTo(MyJaxbObject.class, entry); exchange.getIn().setHeader("MY_UNMARSHALLED_XML", object); } })
Best, Christian Müller ----------------- Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Wed, Jun 5, 2013 at 3:27 PM, Vegi, Vamsi (MAN-Corporate-CON) < vamsi.v...@manheim.com> wrote: > Willem > I am not trying to unmarshal the whole HashMap > I need to unmarshal only one of the item in the Hashmap > > I do know the key, > > So I am looking for something like below > > from(INB_Q_URI) > .routeId(ROUTE_ID_INB_RID) > .log( " START -----------------------------------------") > .unmarshal(jaxb("${body.myHashMap.get(OBJ_FOR_UNMARSHAL)})) > > -thanks > > > > -----Original Message----- > From: Willem jiang [mailto:willem.ji...@gmail.com] > Sent: Tuesday, June 04, 2013 10:23 PM > To: users@camel.apache.org > Subject: Re: how to pass an XML string to the unmarshal in the route > definition > > If you are using JAXB to do the unmarshal work, you need to define a > adapter in the map class[1], as JAXB doesn't support the map directly. > Once you finished your map class, you can set it into your JAXB data > format context and your route should work as expected. > > [1] > http://javaevangelist.blogspot.com/2011/12/java-tip-of-day-generic-jaxb-map-v.html > > -- > Willem Jiang > > Red Hat, Inc. > FuseSource is now part of Red Hat > Web: http://www.fusesource.com | http://www.redhat.com > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > > > On Wednesday, June 5, 2013 at 2:03 AM, Vegi, Vamsi (MAN-Corporate-CON) > wrote: > > > Hello > > > > I have the exchange body as a hashmap > > > > The hashmap has several <key, value> pairs, of which one needs to be > unmarshalled. > > > > How can I pass that particular value (which is XML String) to the > unmarshal In the following route > > > > from(INB_Q_URI) > > .routeId(ROUTE_ID_INB_RID) > > .log( " START -----------------------------------------") > > .unmarshal(jaxb) > > > > > > > > -thank you > > > > >