You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by biswajits <ma...@gmail.com> on 2014/06/17 16:40:33 UTC
Camel Groovy Script
I am new to camel.
I am trying to parse a xml in "routeContext" using groovy.
here is my xml
<event>
<source>IDV</source>
<input>
<modifyPassword class-name="User"
src-dn="cn=edirevent8,ou=users,o=AGS,c=us">
<value></value>
</modifyPassword>
</input>
</event>
i am try to get the "src-dn" from xml and split it to get the "o="
i am trying the following
<setHeader headerName="org">
<groovy>
util = new RouteUtil();
def body = request.getBody();
response.setHeader("org", util.getOrgFromDN(util.getUserDn()))
class RouteUtil{
def getOrgFromDN(String dn){
return dn.split(",")[2].substring(2);
}
def getUserDn(){
def bodyXml = new XmlParser().parseText(body);
return bodyXml.attribute("src-dn");
}
}
</groovy>
</setHeader>
is it possible in camel what i am trying in above code?
thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Groovy-Script-tp5752443.html
Sent from the Camel - Users mailing list archive at Nabble.com.