camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From biswajits <mail.biswaj...@gmail.com>
Subject Camel Groovy Script
Date Tue, 17 Jun 2014 14:40:33 GMT
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.

Mime
View raw message