|
Title: getting a value from soap response Post by: Franky on July 24, 2007, 07:34:28 am hi all,
how to retrieve value from soap response.? suppose i got a response of: <Table> <Town>Bayham Abbey</Town> <County>Kent</County> <PostCode>TN3</PostCode> </Table> <Table> <Town>Bolton Abbey</Town> <County>North Yorkshire</County> <PostCode>BD23</PostCode> </Table> <Table> <Town>Lesnes Abbey</Town> <County>Greater London</County> <PostCode>SE2</PostCode> </Table> i need to retrieve PostCode values. thanks franky Title: Re: getting a value from soap response Post by: omatzura on July 24, 2007, 08:57:28 am 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: Code: // 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 Title: Re: getting a value from soap response Post by: Franky on July 24, 2007, 10:36:04 am 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 Title: Re: getting a value from soap response Post by: Franky on July 25, 2007, 07:43:02 am Hi ole,
Since i am a Novice user for Groovy and its usage, Kindly shed some Light On this. Thanks, Franky Title: Re: getting a value from soap response Post by: nreimertz on July 26, 2007, 10:35:01 am 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/functional/groovystep.html And about how to work with TestCases at http://www.soapui.org/userguide/functional/testcases.html. Hope this helps! /niclas eiware.com |