简体   繁体   中英

How to retrieve elements from soap Payload in WSO2 EI 6.1.1

I am having below soap payload which comes from WSO2 DSS endpoint.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <Response xmlns="http://ws.wso2.org/dataservice">
         <RestrictionCount>
            <count>1</count>
         </RestrictionCount>
      </Response>
   </soapenv:Body>
</soapenv:Envelope>

I want to extract count values from above payload. i tried like "//RestrictionCount/count/text()" by using Online xpath expression tool which gives me result, but in coding i tried the same by using property mediator expression like below which doesn't working for me

<property expression="//RestrictionCount/count/text()" name="count" scope="default" type="STRING"/>

Can anyone please help me into this?

Since you're dealing with namespaces, use local-name() to select the element:

<property expression="//*[local-name()='RestrictionCount']/*[local-name()='count']/text()" name="count" scope="default" type="STRING"/>

Or better, declare the namespace properly just before your XPath expression:

<property xmlns:ns="http://ws.wso2.org/dataservice" expression="//ns:RestrictionCount/ns:count/text()" name="count" scope="default" type="STRING"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM