Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
371 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...