Posts

Showing posts from June, 2018

Read XML content of the LocalEntry in WSO2 ESB

Local Entry is one of the data storage points in the WSO2 Enterprise Service Bus, where you can store text strings, XML content, and File URLs.  I have been asked a question that, how can we read the content of the local entry if it as an XML file.
Below is an example to read the content of the local entry(Name: NameOfLocalEntry) and assign the value of XML elements as properties. 
Content of Local Entry:
<?xml version="1.0"?> <Server> <userName>chandana</userName> <URL>blog.napagoda.com</URL> </Server>
Synapse Configuration: 
<property name="localEntry" expression="get-property('NameOfLocalEntry')" scope="default" type="OM"/>
<property name="userName" expression="$ctx:localEntry//*[local-name()='userName']"/> <property name="URL" expression="$ctx:localEntry//*[local-name()='URL']"/>