camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burkard Stephan <>
Subject AW: Extract xml attribute value and set to request header
Date Wed, 31 May 2017 10:23:24 GMT

In Java DSL you can do it like this: 

.setHeader("myHeader").xpath("/xpath/to/needed/element", String.class)

XPath in Camel:
Set Message-Header example:


-----Urspr√ľngliche Nachricht-----
Von: Amiya Sankar Pradhan [] 
Gesendet: Mittwoch, 31. Mai 2017 11:07
Betreff: Extract xml attribute value and set to request header

Hi All, I am new to apache camel. I need some help on the below issue.

We have a requirement to set a header values(value has to be extracted from the body before
setting) in soap request based on the soap body element received and then reroute it after

Presently we are marsalling the soap body to java object in the router class and getting the
required value and setting it to the header. As the request is very large we are facing memory
leak issue.

therefore we want to read the xml and retrieve the attribute and set it in the header without
converting it to java object.

please let us know how can we achieve that. Also let me know if this approach is correct.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message