Forum Discussion

CarsScott's avatar
CarsScott
New Contributor
9 years ago

How to find a value in multiple nodes returned in a Response so I can pass it to next Request

Hi,

 

Using latest open source SoapUI and I'm calling one w.s. that returns multiple nodes in the response and I need to find the one node that has the value i need to pass it along to next w.s. request.

 

I know how to get all the nodes and pass them into a properties file I just dont know how to find the one I'm looking for to pass it along to the next request.   Mostly a QA tester knowing some simple scripting but not a developer.  :D

 

Here is a snippit of part of the response with just 2 of the nodes, what I did to find within the nodes is the correct vin or assetID, then within that node take the caseID so I can pass it to the next w.s. request.

 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetRequestToCloseResponse xmlns="http://tempuri.org/">
<GetRequestToCloseResult>
<responseType>Success</responseType>
<cases>
<CarsWS_Case>
<responseType>Success</responseType>
<caseID>e777929f-c8e2-4337-9ae2-5bbfb60d69d3</caseID>
<caseNumber>1355300</caseNumber>
<statusChangedDate>6/7/2015 1:05:00 AM</statusChangedDate>
<requestStatus>0</requestStatus>
<assetID>66658ad0-7e71-40f8-a421-0196994313b6</assetID>
<vin>2B3KA43R38H161961</vin>
<make>Dodge</make>
<model>Charger</model>
<year>2008</year>
<status>16384</status>
<createDate>0001-01-01T00:00:00</createDate>
<updateDate>0001-01-01T00:00:00</updateDate>
<serviceType>1</serviceType>
<cost>0</cost>
<licensePlate/>
<actualRepoDate>0001-01-01T00:00:00</actualRepoDate>
<ConditionReportCreateDate>0001-01-01T00:00:00</ConditionReportCreateDate>
<repossesionFee>0</repossesionFee>
</CarsWS_Case>
<CarsWS_Case>
<responseType>Success</responseType>
<caseID>bc0e7313-d2c1-4709-b0f1-814a1ab17138</caseID>
<caseNumber>1331635</caseNumber>
<statusChangedDate>3/5/2015 8:07:00 PM</statusChangedDate>
<requestStatus>0</requestStatus>
<assetID>2571f4ae-8315-4c68-92b8-05785dcbd1f0</assetID>
<vin>WVGAV75N79W541930</vin>
<make>Volkswagen</make>
<model>Tiguan</model>
<year>2009</year>
<status>16384</status>
<createDate>0001-01-01T00:00:00</createDate>
<updateDate>0001-01-01T00:00:00</updateDate>
<serviceType>64</serviceType>
<cost>0</cost>
<licensePlate/>
<actualRepoDate>0001-01-01T00:00:00</actualRepoDate>
<ConditionReportCreateDate>0001-01-01T00:00:00</ConditionReportCreateDate>
<repossesionFee>0</repossesionFee>
</CarsWS_Case>

 

Thanks for any help,

Scott

4 Replies

  • testhrishi's avatar
    testhrishi
    Frequent Contributor

    Hi, you will have to create a property transfer step to grab the particular value from the xpath. for that you will need to write a expression to pull specific value where status equals something

    for example - //*:status[text()='INPROGRESS']/preceding-sibling::*:executionId/text()

    I was able to grab the unique properties from  node using above in soapUI

    • CarsScott's avatar
      CarsScott
      New Contributor

      Thanks so much!

       

      I understand this much of the xpath - //*:status[text()='INPROGRESS']

       

      Could you explain the rest of your expression please?  /preceding-sibling::*:executionId/text()

      • testhrishi's avatar
        testhrishi
        Frequent Contributor

        /preceding-sibling::*: is a literal you can keep that part and then you can provide the element name for the text you are looking to retain from the response node followed by the /text(). Tha should get you the conditional value you looking to grab. I may have to look at the response to know more.