Forum Discussion

NewBear1's avatar
NewBear1
New Contributor
7 years ago

SoapUI Cookie Sample Code not working

I have a test case where I run a REST request and get back the following in the header:

Header: Set-Cookie  Value: jsessionid=20180111

 

In a subsequent Groovy Script step, I have the following code:

import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
def myCookieStore = HttpClientSupport.getHttpClient().getCookieStore()
def myCookies = myCookieStore.getCookies()
log.info myCookies.size()
return;

 

It returns a size of 0.  

 

Why isn't the jsessionid cookie showing up in the Cookie store?

 

I have seen several posts here and elsewhere that list this as code to get returned Cookie values. 

 

https://community.smartbear.com/t5/SoapUI-Pro/SoapUI-Cookie-management/td-p/26097

https://community.smartbear.com/t5/SoapUI-Open-Source/How-to-send-a-cookie/td-p/106960

 

 

My ultimate goal is to send this Cookie with a subsequent response, but I can't seem to get to the point where I even see the cookie.

 

I have tried this with the test case setting "Maintain HTTP Session" both checked and unchecked.  It doesn't seem to make a difference.