Search code examples
jsonpropertiessoapuitransfer

SoapUI: Transfer Response Payload Value to New Request URL (Different Test Steps)


I'm trying to figure out SoapUI, and so far it's been a great tool. However, I cannot figure out this transferring of property stuff. I've read so much and just can't seem to find the answer I'm looking for.

I have one request: POST http://localhost/restaurant

I receive the following Response Payload back:

HTTP/1.1 200 OK
Date: Tue, 07 Jul 2015 22:50:27 GMT
Content-Type: application/json
Content-Length: 35

    {
      "supplementalInfo":null,
      "id":1146
    }

I then want to take the "id" value and place it in the following request: DELETE http://localhost/restaurant/{id}

I've tried: /restaurant/${Create A New Restaurant#Response#//*:id} WHERE "Create A New Restaurant" is the name of the Test Step where the response payload is from to no avail.

What am I missing? Thank you so much in advance for your help!


Solution

  • Your Response from "Create A New Restaurant" is application/json, but you are using the XPath (XML) notation to transfer the value! That is not going to work.

    Luckily, SoapUI internally converts almost anything to XML representation. To get at that, you will need to use: ${Create A New Restaurant#ResponseAsXml#//*:id}. Note the extra "AsXml" in there.