Ask a Question

Need to save cookies from intermediate calls when redirect option is true

manikuma3
New Contributor

Need to save cookies from intermediate calls when redirect option is true

Hi,

 

I am trying to add few APIS in SoapUI to pass the login credentials and get the auth token in return. The first leads to redirecting it to further APIs.  The intermediate calls return some keys as cookie in response and I need to retain those to use in my subsequent calls. I did try by setting redirect option to false but all the calls it redirects works only if it is redirected from the main call. When I try ti run those individually, I do not get any response.

 

 

Is there a way in SoapUI to retain all the cookie values from intermediate calls ?

 

Thanks,

 

Manish

2 REPLIES 2
JKambli
Staff

Re: Need to save cookies from intermediate calls when redirect option is true

You can save the cookie in a testcase property and pass it next request,

If the token is in header,

You can capture the response headers with a groovy script and then save them in a testCase property,

def value = testRunner.testCase.testSteps["Request"].testRequest.response.responseHeaders["Set-Cookie"]

testRunner.testCase.setPropertyValue("token",value )

 

Here is the expansion ${#TestCase#token}

 

 



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
manikuma3
New Contributor

Re: Need to save cookies from intermediate calls when redirect option is true

Hi,

 

Thanks for quick response. My problem is that I cannot set Follow Redirects option to false and I could not find a way to capture the cookie from the response header of the intermediate calls.

 

 

Thanks,

 

Manish

cancel
Showing results for 
Search instead for 
Did you mean: