Showing results for 
Search instead for 
Did you mean: 

SoapUI Cookie management


SoapUI Cookie management


I'm trying to automise REST-api tests.
In some off my tests I need to have a session-token, to be able to run the wanted REST request.

To get a session-token I need to do the following:
1) Login to my test site, so that Im logged in in my browser
2) From my browser call a support REST service (only exists in test environment)
3) Copy out the castTicket I get from the call above
4) Do a REST-POST to the specific game installation - token service, with my castTicket
5) Copy the returned token and use that in my following testcases

We have this up and running in JMeter (2.3.2). But cant get it to work in SoapUi.


Succeeded in logging in, but 2) fails.
When logging in, several cookies are returned. Two of these cookies are neccessary
for 2). Seems like SoapUi doesnt save all returned cookies. I cant find them anyhow.

I have "Maintain HTTP Session" selected and teststeps have "Follow redirects" = true.
I'm running on 64-bit Windows 7, with 64-bit soapui 4.5.

When we got this working in JMeter we used the 'cookiemanager' and had to set 'follow redirects'.

I suspect that SoapUi doesnt save cookies between redirects (or something simiular).

Anyhow is there a way to get this working?
Rather use SoapUi than JMeter if possible.


Re: SoapUI Cookie management

Done some more tracing in loggs.
SoapUi handles the Cookies and as far as I can see it sends the rigth ones.
We have a complex login procedure to get hold of a Token (for the comming tests).
From what I can deduct from the logs it seems like our server is not pleased with
the client calls from soapui, in the redirects the server sends new ticket hashes
in every call. When running from soapui the server does not send these tickets.

So this is a problem we own, will have to solve this one myself.

But in my tests I want to check what happens when cookies are NOT sent.
So new question:
How can I delete/block cookies from soapui?
(tried to set Cookie in request header to dummy value, but didnt help. The old saved cookies get sent anyway)

Suspect I need to get hold of the com.teamdev.jxbrowser.cookies.CookieManager.removeAll() method.
Dont know how to get hold of it though.

New Contributor

Re: SoapUI Cookie management

I have similar question.
In soapUi 4.0.1 i used to login, get cookie, and then post this cookie with request. So i can have loged in more users and by changing cookie i changed which user is sending request.
In soapUi 4.5.0 soapui save cookie and then send cookie with every request. It is possible to turn of this function? So i can managed cookies manually?
LoadUi 2.0.0 is working in same way as 4.5.0
Thaks for reply

Re: SoapUI Cookie management

My latest findings.
Seems there is a bugg in the cookie handling after all.
I login and get a sessioncookie.
I ask my internal security server to give me a token (to be logged in for all tests)
I then get redirected, the security server set a secret cookie based on my session cookie.
Several redirects takes place and in these both cookies needs to exists.
Soapui never sets the second 'secret cookie' (the webbrowsers do, tested firefox & chrome).

So I came up with some groovy scripts to manually handle this.
Here is a example script on how to handle cookie manager and create cookies:

import org.apache.http.impl.cookie.BasicClientCookie

//the http client -- org.apache.http.impl.client.DefaultHttpClient
def myClient = HttpClientSupport.getHttpClient()

//clients cookie store -- org.apache.http.client interface CookieStore
def myStore = myClient.getCookieStore()

// to remove all cookies

// Get list of all cookies
def cookieList = myStore.getCookies()

// "nbr---of---cookies : " + cookieList.size()

def my_old_cookie

//find my old cookie that I want to copy value from
for (i in cookieList) { // i is a cookie
if (i.getName().contains("my_old_cookie")) {
my_old_cookie = i

//Create new cookie
def my_new_cookie = new BasicClientCookie("my_new_cookie",my_old_cookie.getValue())

//add the created new cooki to the cookiemanager
New Contributor

Re: SoapUI Cookie management

It is great stuff although it was years ago.

But the returned size is 0

Community Hero

Re: SoapUI Cookie management

Will return the count if there are any, zero otherwise.
If you have further queries, suggest you to create a new thread.


Re: SoapUI Cookie management

Hey, a little bit of time. But could you help me with this step:


 1) Login to my test site, so that Im logged in in my browser. not being able to do this.. Could somebody help?

New Here?
Join us and watch the welcome video:
Top Kudoed Authors