Check the jmeter log file - you'll probably see something like: WARN - jmeter.extractor.XPathExtractor: error on XPathExtractor.xpathQuery(//ns:result)Prefix must resolve to a namespace: ns
I tried //resultCode and that worked OK. I don't know enough about XPath to know why the namespace is not being resolved; it appears to be defined in the parent node. I checked the code, and the documentFactory was being called with namespace=false, but when I changed it to namespace=true it did not seem to make any difference. However, I then moved the xmlns:ns declaration to the soapenv:Envelope element, and it worked - provided that namespace=true (which is not the case currently). Perhaps the XPath implementation (xalan) is not able to resolve namespaces defined in nested elements? I need to look at this further. I'll raise a bug to be able to set namespace=true on the documentFactory. S. On 30/08/07, dasarih <[EMAIL PROTECTED]> wrote: > > Hi, > > I am unable to extract value of an element when it has a namespace prefix. > Can someone please give me a sample script on how to use "XPath Extractor" > and "XPath Assertion" for a WebService (SOAP) request/response. > > Here is the response from which I need to extract the value for "ns:result": > *********************************** > <?xml version="1.0" encoding="utf-8"?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><ResponseHeader > xmlns="http://biz.aol.com/schema/header/2006-10"><statusCode>200</statusCode><statusText>Ok</statusText><requestId>5498812049246984836--661430c8.114b6ef1996.-7a4e</requestId></ResponseHeader></SOAP-ENV:Header><SOAP-ENV:Body > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><ns:registerOfferResponse > xmlns:ns="http://biz.aol.com/schema/2006-12-18"><ns:result>0</ns:result></ns:registerOfferResponse></SOAP-ENV:Body></soapenv:Envelope> > *********** > > I have tried different variations of XPATH Query and here are some I tried: > > ************* > /soapenv:Envelope/SOAP-ENV:Body/ns:registerOfferResponse/ns:result > > ************* > //ns:result > > ************* > /*[local-name(.)="Envelope" and > namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"]/*[local-name(.)="Body" > and > namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"][1]/*[local-name(.)="registerOfferResponse" > and > namespace-uri(.)="http://biz.aol.com/schema/2006-12-18"][1]/*[local-name(.)="result" > and namespace-uri(.)="http://biz.aol.com/schema/2006-12-18"][1]/text() > ************* > > Your help is sincerely appreciated. > > Thank you. > -- > View this message in context: > http://www.nabble.com/Unable-to-extract-using-XPath-Extractor-tf4354380.html#a12407599 > Sent from the JMeter - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

