how to set jms message custom header using xpath in camel route -
i using camel route builder move 1 activemq jms message 1 queue setting custom header, using xpath read node value xml. nothing has been set. please suggest if know answer.
from("activemq:com.queue1") .setheader("ordernumber").xpath("/orderrequest/authnumber") .to("activemq:com.queue2") .end();
xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <ns3:orderrequest xmlns:ns2="http://www.company.com/services/entity/v1" xmlns:ns3="http://www.company.com/services/dataobject/v1"> <authnumber>a81585</authnumber> </ns3:orderrequest>
xml namespaces requires name spaces setup correctly.
you need setup namespace handler this:
namespaces ns = new namespaces("ns3", "http://www.company.com/services/dataobject/v1"); .... xpath("/ns3:orderrequest/ns3:authnumber",ns) ...
Comments
Post a Comment