Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Nreimondo1645519314
Contributor III
Contributor III

Set variable xPath using in headers

Hi all,

I'm getting stuck setting a variable xpath in my route using existing headers from the incoming exchange.

For example the incoming body is <Employee><EmployeeNO></EmployeeNO></Employee>

but it could also be <Empl><Emplno></Emplno></Empl>

Message one will have a header 'Level1' with value 'Employee' and a header 'Level2' with value 'EmployeeNO'

and message two will have a

header 'Level1' with value 'Empl' and a header 'Level2' with value 'Emplno'

Now I try to set a header with the complete xpath based on the values of headers 'Level1' and 'Level2'.

Component cSetHeader doesn't accept a value like "/exchange.getIn().getHeader("Level1",String.class)/exchange.getIn().getHeader("Level2",String.class)"

And when I set a header with exchange.getMessage().setHeader(), the header will be set as a string instead of a xpath value.

Can anybody help me please? The idea is to read the value of 'level2' in the XML structure of every incoming message. But it must be configured variably, because the values of the levels will be different each message. (But headers 'Level1' and 'Level2' will always be there with the tagnames)

Labels (2)
0 Replies