Forum Discussion

zelot's avatar
zelot
New Contributor
9 years ago
Solved

How to extract value from xml response in script assertion

Hi, After sendig a soap request I get this as my response: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:genXXYYZZ xmlns:ns2="http://zzzzzzz.yyy.com/"> <return> <te...
  • nmrao's avatar
    9 years ago

    Oh, you are trying to get data from request, but not on the response.

    Here you go:

     

    def Envelope=new XmlSlurper().parseText(messageExchange.request.requestContent)
    def status = Envelope.Body.genXXYYZZ.return.test.status
    log.info status
    assert OK == status, "Status is not ok"