firen
firen

Reputation: 1424

WSO2 xml property xpath to child element

I have following code:

<property name="resultOM" scope="default" type="OM">
    <test><test1>testing111</test1></test>
</property>

<log level="full">
    <property name="ROOT" expression="$ctx:resultOM" />
    <property name="resultOM.test" expression="$ctx:resultOM//test1" />
</log>

Then I would expect to see in logs values ROOT = testing111 resultOM.test = testing111

and although ROOT value is fine, the value of resultOM.test is empty. What should be the correct xpath to retrieve the child value? Version of used WSO2ESB is 4.5.1.

Upvotes: 0

Views: 1795

Answers (1)

Rajkumar Rajaratnam
Rajkumar Rajaratnam

Reputation: 925

A default namespace (http://ws.apache.org/ns/synapse) is defined when you create an OM type property. So you need to perform xpath expressions with namespaces. Try this;

<log level="full">
   <property name="ROOT" expression="$ctx:resultOM"/>
   <property name="resultOM.test" xmlns:ns="http://ws.apache.org/ns/synapse" expression="$ctx:resultOM//ns:test1"/>
</log>

Read [1] for more details.

[1] http://isharapremadasa.blogspot.com/2014/08/wso2-esb-property-mediator-performing.html

Upvotes: 3

Related Questions