Forum Discussion

rfortune's avatar
rfortune
Contributor
15 years ago

Working with the Raw response

Hi Guys, we have had an issue with our API response and as a result I'm trying to write a test that checks for the issue in future. I'd like to be able to perform assertions on the full RAW response however I cannot see how to access it. when using xmlSlurper it only reads a sanitized response (which is stored in the Test Properties).

I cannot access the header info, I am also unable to check for the present of any unwanted extra info being return in the overall response. I guess the distinction here is that I want to work with the RAW response fromour API and not the filtered response as SOAPUI perceives it.

Cheers,
- Richard

3 Replies

  • Hello,

    you can try one of or all of these Groovy script statements
    (I've tested this using script assertion on test step):

    log.info messageExchange.getResponseContent().toString() // <- you've probably seen this one

    for (header in messageExchange.getResponseHeaders())
    log.info header //<- prints all headers

    log.info new String(messageExchange.getRawResponseData()) // <- this is raw response data

    Hope this helps!

    Vladimir
    SmartBear Software
  • Hi Vlad, coding isn't my strong point so I'm having difficulty executing these. It looks like messageExchange doesn't work natively in the Groovy Script context.
  • rfortune wrote:
    Hi Vlad, coding isn't my strong point so I'm having difficulty executing these. It looks like messageExchange doesn't work natively in the Groovy Script context.

    What error message do you get (what is the content of the bottom error log tab)?

    Regards

    Henrik
    SmartBear Software