REST Call store cookie

Hi, in postman i use store the cookie from response login into a variable e reuse it in others call, in katalon is it possibile?

this is my service test (200 OK, work fine, but not save the cookie in my GlobalVariable)

import static org.assertj.core.api.Assertions.*

import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webservice.verification.WSResponseManager

import groovy.json.JsonSlurper
import internal.GlobalVariable as GlobalVariable

println("--------------------------PRIMA---------------------------")
println("GlobalVariable.cookie prima")
println(GlobalVariable.cookie);
println(GlobalVariable.partner_name);
println("-----------------------------------------------------")

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()

ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()

def jsonSlurper = new JsonSlurper()

def jsonResponse = jsonSlurper.parseText(response.getResponseText())

WS.verifyResponseStatusCode(response, 200);

WS.verifyElementPropertyValue(response, 'access_token', jsonResponse.access_token?.trim())


GlobalVariable.cookie=jsonResponse.access_token;
println("--------------------------ACCESS TOKEN---------------------------")
println("jsonResponse.access_token "+jsonResponse.access_token)
println("-----------------------------------------------------")
println("-------------------------- DOPO ---------------------------")
println("GlobalVariable.cookie dopo")
println(GlobalVariable.cookie);
println("-----------------------------------------------------")

RESPONSE WITH TEST PASSED

2019-12-05 15:04:12.664 INFO  c.k.k.core.main.WSVerificationExecutor   - --------------------
2019-12-05 15:04:12.667 INFO  c.k.k.core.main.WSVerificationExecutor   - START Verification
2019-12-05 15:04:13.144 DEBUG testcase.                                - 1: println("-----------------------------------------------------")
-----------------------------------------------------
2019-12-05 15:04:13.161 DEBUG testcase.                                - 2: println("GlobalVariable.cookie prima")
GlobalVariable.cookie prima
2019-12-05 15:04:13.164 DEBUG testcase.                                - 3: println(cookie)
null
2019-12-05 15:04:13.891 DEBUG testcase.                                - 4: println(partner_name)
katalonpartner
2019-12-05 15:04:13.894 DEBUG testcase.                                - 5: println("-----------------------------------------------------")
-----------------------------------------------------
2019-12-05 15:04:13.898 DEBUG testcase.                                - 6: request = getInstance().getCurrentRequest()
2019-12-05 15:04:14.137 DEBUG testcase.                                - 7: response = getInstance().getCurrentResponse()
2019-12-05 15:04:14.148 DEBUG testcase.                                - 8: jsonSlurper = new groovy.json.JsonSlurper()
2019-12-05 15:04:14.159 DEBUG testcase.                                - 9: jsonResponse = jsonSlurper.parseText(response.getResponseText())
2019-12-05 15:04:14.180 DEBUG testcase.                                - 10: verifyResponseStatusCode(response, 200)
2019-12-05 15:04:14.274 DEBUG testcase.                                - 11: verifyElementPropertyValue(response, "access_token", access_token.trim())
2019-12-05 15:04:14.326 DEBUG testcase.                                - 12: cookie = access_token
2019-12-05 15:04:14.328 DEBUG testcase.                                - 13: println("--------------------------ACCESS TOKEN---------------------------")
--------------------------ACCESS TOKEN---------------------------
2019-12-05 15:04:14.332 DEBUG testcase.                                - 14: println("jsonResponse.access_token " + access_token)
jsonResponse.access_token eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJnaGlibGkiLCJhM2ciOlsiVXNlcnMiLG51bGxdLCJhM3BlcCI6ImdoaWJsaSIsImlzcyI6ImEzc2VydmVyIiwiYTNwdCI6InlZMzFIcU5veVdXWjNwQjA4akpRK3c9PSIsImlhdCI6MTU3NTU1NDY0NywianRpIjoiNGUxMWM1YmQtY2ZkNi00NzQ2LWJjYWQtMWRmNjkyNTQ1MGMwIn0.z00EK15e9nqOcHlRKUV1gNZJGrM3R1VzcryRN9UUmxWZdc1NSL5dt0byDHrZyNoGlFhko_xuKLMYttDZbocWkQ
2019-12-05 15:04:14.339 DEBUG testcase.                                - 15: println("-----------------------------------------------------")
-----------------------------------------------------
2019-12-05 15:04:14.348 DEBUG testcase.                                - 16: println("-------------------------- DOPO ---------------------------")
-------------------------- DOPO ---------------------------
2019-12-05 15:04:14.352 DEBUG testcase.                                - 17: println("GlobalVariable.cookie dopo")
GlobalVariable.cookie dopo
2019-12-05 15:04:14.355 DEBUG testcase.                                - 18: println(cookie)
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJnaGlibGkiLCJhM2ciOlsiVXNlcnMiLG51bGxdLCJhM3BlcCI6ImdoaWJsaSIsImlzcyI6ImEzc2VydmVyIiwiYTNwdCI6InlZMzFIcU5veVdXWjNwQjA4akpRK3c9PSIsImlhdCI6MTU3NTU1NDY0NywianRpIjoiNGUxMWM1YmQtY2ZkNi00NzQ2LWJjYWQtMWRmNjkyNTQ1MGMwIn0.z00EK15e9nqOcHlRKUV1gNZJGrM3R1VzcryRN9UUmxWZdc1NSL5dt0byDHrZyNoGlFhko_xuKLMYttDZbocWkQ
2019-12-05 15:04:14.357 DEBUG testcase.                                - 19: println("-----------------------------------------------------")
-----------------------------------------------------
2019-12-05 15:04:14.362 INFO  c.k.k.core.main.WSVerificationExecutor   - END Verification


i can try many times but the first GlobalVariable.cookie println will be "null"

Hi @luca_bottoni,
If you execute verification script, then any assignment to you global variable will take effect for that execution only. The value will not be persisted for later uses.
Regards.