如何从 WSO2 EI 6.1.1 中的 soap Payload 中检索元素
How to retrieve elements from soap Payload in WSO2 EI 6.1.1
我有以下来自 WSO2 DSS 端点的 soap 负载。
<?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>
我想从上面的负载中提取 count 个值。我尝试使用 Online xpath expression tool 像“//RestrictionCount/count/text()”一样给出结果,但在编码中我尝试使用如下所示的 属性 中介表达式进行相同的操作,但对我不起作用
<property expression="//RestrictionCount/count/text()" name="count" scope="default" type="STRING"/>
谁能帮我解决这个问题?
由于您要处理名称空间,因此请使用 local-name()
到 select 元素 :
<property expression="//*[local-name()='RestrictionCount']/*[local-name()='count']/text()" name="count" scope="default" type="STRING"/>
或者更好的是,在 XPath 表达式之前正确声明命名空间:
<property xmlns:ns="http://ws.wso2.org/dataservice" expression="//ns:RestrictionCount/ns:count/text()" name="count" scope="default" type="STRING"/>
我有以下来自 WSO2 DSS 端点的 soap 负载。
<?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>
我想从上面的负载中提取 count 个值。我尝试使用 Online xpath expression tool 像“//RestrictionCount/count/text()”一样给出结果,但在编码中我尝试使用如下所示的 属性 中介表达式进行相同的操作,但对我不起作用
<property expression="//RestrictionCount/count/text()" name="count" scope="default" type="STRING"/>
谁能帮我解决这个问题?
由于您要处理名称空间,因此请使用 local-name()
到 select 元素 :
<property expression="//*[local-name()='RestrictionCount']/*[local-name()='count']/text()" name="count" scope="default" type="STRING"/>
或者更好的是,在 XPath 表达式之前正确声明命名空间:
<property xmlns:ns="http://ws.wso2.org/dataservice" expression="//ns:RestrictionCount/ns:count/text()" name="count" scope="default" type="STRING"/>