Forum Discussion

manikuma3's avatar
manikuma3
New Contributor
8 years ago

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

  • 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}

     

     

    • manikuma3's avatar
      manikuma3
      New Contributor

      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