Forum Discussion

Franky's avatar
Franky
Occasional Contributor
17 years ago

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

  • omatzura's avatar
    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's avatar
    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's avatar
    Franky
    Occasional Contributor
    Hi ole,

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

    Thanks,
    Franky