Forum Discussion

lukapril's avatar
lukapril
Occasional Contributor
16 years ago

How to retrieve and save response header value using soapUI

I'm using soapUI version 3.0.1 and POSTing a RESTful request to an uri, the expected response header will contain a token value that I'm interested in, is there a way to retrieve a value from the reponse header and save the value as a parameter?

Here is how the response header look like:
Header      Value
#status#   HTTP/1.1 302 Found
Content-Length   0
Location    info?token=123efwers
X-Powered-By    ASP.NET
Server     Microsoft-IIS/7.0

2 Replies

  • ive got the same problem. we have to keep our cookies alive to test some services but using the 'maintain http session' option does absolutely nothing.

    I was thinking of writing a groovy script to do this but ive got no idea where to start. Any suggestions?
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    To output the headers from a Groovy script, try the following:

    [tt:1npbx0hl]testRunner.testCase.getTestStepByName(TestRequestName).httpRequest.response.responseHeaders.each() { header ->
    log.info header
    }[/tt:1npbx0hl]