WSO2 ESB - Xpath 表达式 returns SOAP 响应上的空值
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 获取响应值 response.For 我使用了 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( )
我有一个调用端点并更新 通过数据服务在数据库中响应。我已经做了必要的 当我调用端点时 得到以下响应,这是预期的响应(此响应正在日志文件中打印)。
<?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 获取响应值 response.For 我使用了 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( )