1

In Qmetry, trying to validate xpath from the soap api response. But it returns false.

API response has root is <soapenv:Envelope (can't paste full response as its content is big)

When tried running below steps. With both options below.

And response should have xpath '/soapenv:Envelope'
And response should have xpath '/Envelope'

This returns False though the response has xpath.

Can any one please help me in resolving this isse?

sanjay pujari
  • 459
  • 2
  • 7
  • 23
  • without response/xml it's difficult to suggest. you can provide partial content. Also try `.//Envelope` or `//Envelope` instead of `/Envelope` refer https://stackoverflow.com/a/35606964/861594. Furthermore it's not necessary to write absolute path. If `Envelope` is root element you should not use it in your xpath. – user861594 Jan 11 '21 at 07:23

1 Answers1

0

If Envelope is root element you should not use it in argument to response should have xpath. Given following as sample response:

<SOAP-ENV:Envelope
   xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
   SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

   <SOAP-ENV:Body xmlns:m = "http://www.example.com/quotation">
      <m:GetQuotationResponse>
         <m:Quotation>Here is the quotation</m:Quotation>
      </m:GetQuotationResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The root node (Envelope in this case)need not to be added in xpath or used as . Following xpaths should work:

./Body
.//Body
//Body
//GetQuotationResponse
//Body/GetQuotationResponse/Quotation
//GetQuotationResponse/Quotation
//Quotation
user861594
  • 5,733
  • 3
  • 29
  • 45