Ask a Question

getting a value from soap response

Franky
Occasional Contributor

getting a value from soap response

hi all,

how to retrieve value from soap response.?

suppose i got a response of:

    Bayham Abbey
    Kent
    TN3
 


    Bolton Abbey
    North Yorkshire
    BD23
 

 
    Lesnes Abbey
    Greater London
    SE2
 



i need to retrieve PostCode values.

thanks
franky
4 REPLIES 4
omatzura
Super Contributor

Hi Franky,

create a groovy-script step after your request that gets the response message and parses it using any of the available XML-parsing options in groovy (http://groovy.codehaus.org/Processing+XML)..  for example:

// get request property
def request = testRunner.testCase.getTestStepByName( "Request 1" )
def property = request.getProperty( "request" )

// parse out textnodes to modify
def node = new groovy.util.XmlParser(false,false).parseText(property.value)
...


Hope this helps!

regards,

/Ole
eviware.com
Franky
Occasional Contributor

hi ole

thanks for the response . i have gone through the link that u have sent...

since i am a newbie user, i dont know where to insert the groovy script and get a value from the response.could u plz explain in detail

thanks
franky
Franky
Occasional Contributor

Hi ole,

Since i am a Novice user for Groovy and its usage, Kindly shed some Light On this.

Thanks,
Franky

Hi!

If you right click in the TestCase editor or right click in the project tree on a TestCase (it usually says Test Steps ()) you will be able to choose Add Step/Groovy Script.

You can read mote about how to use Groovy Scripts at:

http://www.soapui.org/userguide/functio ... ystep.html

And about how to work with TestCases at

http://www.soapui.org/userguide/functio ... cases.html.

Hope this helps!

/niclas
eiware.com
Product Guy for Ready! API, SoapUI and all things API
cancel
Showing results for 
Search instead for 
Did you mean: