Ask a Question

How i tranfer a cookie from a response (raw) in a next step and send it there

Regular Visitor

How i tranfer a cookie from a response (raw) in a next step and send it there


I am beginning to work with SoapUI and so my level is not high and so a have a question..

I have a Rest-Service and i must login on a website and get in the response a cookie.

For the next steps i must use and send this cookie on a other website to be able to test on this site the api.

So, now my question. How can i transfer this cookie in the next step and send it?



Best Regards


Community Hero



If I understand correctly - this seems fairly straight forward - if I'm getting the gist


the cookie's in the response headers - right?  There's a bit of groovyscript one of the other lads on the forum gave me to do this.


Essentially  you need to perform a property transfer, grabbing the cookie's value writing it either directly to the subsequent request or a Properties step.  I did the same thing on a test case and it had the following steps


1st REST request step (generates the cookie)

Groovy step

Properties step

2nd REST request step


The code to grab the cookie's value from the 1st REST step headers and save it to the Properties step is as follows:


//Takes one of the elements of the response Header
def value = testRunner.testCase.testSteps["1st REST request step)"].testRequest.response.responseHeaders["cookieName"]

//Read this value into a parameter
def groovyUtils = new context )
groovyUtils.setPropertyValue("Properties", "cookieName",value[0])

If I understand what you need - this will do it - if I don't then I've wasted your time reading this and mine typing this out! πŸ™‚





if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Community Hero

Just right click on the test case -> settings -> maintain http session. This should do it...

If my answer helped please click on the 'Accept as Solution' button.
SmartBear Alumni (Retired)

Hi all,


Thanks a lot, Community Leaders!


@Rincewind, did the above suggestions help you?
If your question was answered, can you please mark the reply that helped you as a Solution so that other users could find it easily in the future?

Thanks in advance,



Olga Terentieva
SmartBear Assistant Community Manager

Showing results forΒ 
Search instead forΒ 
Did you mean:Β