[英]WSO2 ESB - Xpath expression returns null value on SOAP response
我有一個基本的序列,它調用一個端點並通過數據服務更新數據庫中的響應。 我已經完成了必要的工作,在調用端點時,我得到了以下響應,這是預期的響應(此響應已打印在日志文件中)。
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-19033">
<wsu:Created>2016-04-26T04:35:21.802Z</wsu:Created>
<wsu:Expires>2016-04-26T04:40:21.802Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns2:purchaceFromMMRResponse xmlns:ns2="http://flw.mwt.mobitel.com/">
<return>
<amount>1.0</amount>
<date>26042016</date>
<mobile>0711325362</mobile>
<recipetNo>20160426100525249665</recipetNo>
<resultCode>1999</resultCode>
<resultDesc>Dear Customer,Service is not available due to a technical failure. Please try again in a while .</resultDesc>
<time>100449</time>
<transactionId>SDC311521</transactionId>
</return>
</ns2:purchaceFromMMRResponse>
</soapenv:Body>
</soapenv:Envelope>
要調用數據服務(並更新響應字段),我需要從soap響應中獲取響應值。為此,我使用了xpath表達式來獲取將在屬性中設置然后在數據服務中使用的值。
<property expression="//ns2:return/ns2:mobile/text()"
name="mobile" scope="default" type="STRING" xmlns:ns2="http://flw.mwt.mobitel.com/"/>
在執行自定義日志時將值設置為屬性后
<log level="custom">
<property expression="$ctx:mobile" name="mobile"/>
</log>
該值未打印。 如果我在這里做錯什么,請糾正我。
節點return和mobile不屬於ns2命名空間,請嘗試// return / mobile / text()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.