Anson1000
8 years agoOccasional Contributor
How to get response property value and use it as next step input
Version SoapUI 5.3 The first step Get country by country code (I input “in”, and I should get country name “India”) I want to user the country name “India” as input country name for the second...
- 8 years ago
Just FYI there's no need to use Groovy, a regular Property Transfer will work just as well.
Source (step): GetCountryByCountryCode
Property: Response
Path language: XPath
Expression:(saxon:parse(//*:GetCountryByCountryCodeResult))//Table[1]/name
or just
(saxon:parse(//*:GetCountryByCountryCodeResult))//name
(it seems that saxon picks the 1st matching node by default)
Target: The test step where you need to use the "India" value
Property: Request
Path language: XPathExpression: An XPath expression for the target request field. For example, if you want to use the "India" value in the GetCurrencyByCountry operation that uses this request body
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET"> <soap:Header/> <soap:Body> <web:GetCurrencyByCountry> <web:CountryName>India</web:CountryName> </web:GetCurrencyByCountry> </soap:Body> </soap:Envelope>
the request XPath expression would be
//*:CountryName
I attached a sample project to demonstrate the above.