Enterprise Integration Zone is brought to you in partnership with:

I am a graduate of University of Westminster UK (IIT) B Sc Software Engineering ( First Class Honours). I am a Sun Certified Java Programmer for Java 2 platform, 1.5 versions (SCJP 1.5). – 93% and a Sun Certified Web Component Developer 97%. I work as a Software Engineer at WSO2. Achala is a DZone MVB and is not an employee of DZone and has posted 20 posts at DZone. You can read more from them at their website. View Full User Profile

Retrieve Values From XML in Config Registry with WSO2 ESB

02.21.2013
| 3072 views |
  • submit to reddit
The following configuration can retrieve the values in a config registry using the WSO2 ESB.

<proxy xmlns="http://ws.apache.org/ns/synapse" name="test123" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="test" expression="get-property('registry','conf:/test.xml')" scope="default" type="OM" />
         <log level="custom">
            <property name="test.b" expression="$ctx:test//b" />
         </log>
      </inSequence>
      <outSequence>
         <send />
      </outSequence>
      <endpoint>
         <address uri="http://localhost:8280/services/Version" />
      </endpoint>
   </target>
   <publishWSDL uri="http://localhost:8280/services/Version?wsdl" />
   <policy key="conf:/repository/axis2/service-groups/test123/services/test123/policies/61afea637b914422e1753dde4e88864cc199fecbb66084e2" />
   <policy key="conf:/repository/axis2/service-groups/test123/services/test123/policies/urn:version" />
</proxy> 

Then create an xml file in the config registry with following content.

<a>Hello<b>WSO2</b></a>

You will see the following log

[2013-02-18 23:33:35,690] INFO - LogMediator test.b = WSO2 
Published at DZone with permission of Achala Chathuranga Aponso, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)