[英]JMeter XPath Extractor Issue
I am trying to retrieve data from below XML but all the options i tried are giving me null value. 我正在尝试从XML下面检索数据,但是我尝试过的所有选项都为我提供了空值。 Can someone please help!!!
有人可以帮忙!!!
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns8:SearchQuoteResponse
xmlns="http://services.akshay.com/pr/search" xmlns:ns2="http://services.akshay.com/pr/po"
xmlns:ns3="http://services.akshay.com/pr/common"
xmlns:ns4="http://services.akshay.com/pr/fault"
xmlns:ns5="http://services.akshay.com/pr/appointment"
xmlns:ns6="http://services.akshay.com/pr/registration"
xmlns:ns7="http://services.akshay.com/pr/in"
xmlns:ns8="http://services.akshay.com/Services/ws"
xmlns:ns9="http://services.akshay.com/pr/q">
<ns8:responseType>SUCCESS</ns8:responseType>
<ns8:message>Quote Search completed successfully.</ns8:message>
<ns9:Quote>
<ns9:quoteId>72620</ns9:quoteId>
<ns9:quoteResponse>
<ns9:quoteExpiryDate>2013-08-04T10:17:35.000Z</ns9:quoteExpiryDate>
<ns9:listQuoteItemResponse>
<ns9:respQuoteItemId>657222</ns9:respQuoteItemId>
<ns9:lineNumber>1</ns9:lineNumber>
<ns9:afterMarketPartDetails>
<ns3:warrantyType />
</ns9:afterMarketPartDetails>
<ns9:listPrice>153.0</ns9:listPrice>
<ns9:netPrice>61.2</ns9:netPrice>
<ns9:partAvailability>IN</ns9:partAvailability>
<ns9:shippable>Y</ns9:shippable>
</ns9:listQuoteItemResponse>
</ns9:quoteResponse>
<ns9:createdDate>2013-06-20T16:17:34.996Z</ns9:createdDate>
</ns9:Quote>
</ns8:SearchQuoteResponse>
</S:Body>
</S:Envelope>
From the above SOAP i need value of <ns9:respQuoteItemId></ns9:respQuoteItemId>
tag, but XPath Extractor always gives me null value. 从上面的SOAP中,我需要
<ns9:respQuoteItemId></ns9:respQuoteItemId>
标记的值,但是XPath Extractor始终为我提供空值。 I have tried below options - 我已经尝试过以下选项-
1 - //*[local-name()="respQuoteItemId"]/text()
2 - //*[local-name()='respQuoteItemId' and namespace-uri()='http://services.myportal.com/procurement/q']
3 - //ns8:SearchQuoteResponse/ns9:Quote/ns9:quoteResponse/ns9:listQuoteItemResponse/ns9:respQuoteItemId
Read this : 读这个 :
http://jmeter.apache.org/usermanual/component_reference.html#XPath_Assertion http://jmeter.apache.org/usermanual/component_reference.html#XPath_Assertion
To overcome Xalan XPath parser implementation on which JMeter is based, you can help the parsing by providing a Properties file which will contain: - prefix1=Full Namespace 1 - prefix2=Full Namespace 2 ... You reference this file in user.properties file using the property: - xpath.namespace.config=<path to your properties file>
您的第三个答案是最接近的,但是要完整填写,中间缺少/ns9:quoteResponse/
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.