Forum Discussion

Aaronliu's avatar
Aaronliu
Frequent Contributor
13 years ago

Operate Response

Dear All,
I have a test case, consist of two steps, step1 is a request, step2 is a groovy script.
I want to check some values return from reponse in step2. how to get the object of response to check?
now I only add script assertion in response to check these values.
example:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
//get xmlHolder
def responseHolder = groovyUtils.getXmlHolder( messageExchange.responseContent )
//get namespace
responseHolder.namespaces['ns1']='http://www.webservicex.net';
def placeName=responseHolder.getNodeValue("count(//ns1:GetWeatherByPlaceNameResponse[1]/ns1:GetWeatherByPlaceNameResult[1]/ns1:Details[1]/ns1:WeatherData)")
assert placeName!=null

1 Reply

  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    Oh, I knew, I find the way to solve this question, just only change the parameter messageExchange.responseContent into "TestStepName#Response"

    another question: if the response return successfully, and contains the same 10 nodes, the next, I need to fetch some values in each node, and then I want to use these values next step. how can I store these values? Array or Property?

    hopefully, you guys can give me some instructions and comments?


    thank you,
    Aaron