1

I use code below to get value of JSESSIONID from request in SoapUI.

def setCookie = testRunner.testCase.testSteps["Request1"].testRequest.response.responseHeaders["Set-Cookie"]
re = /(JSESSIONID=[A-Za-z0-9]+)/
matcher = ( setCookie =~ re )
def jsesid = matcher[0][0]
log.info "$jsessid"

props = testRunner.testCase.getTestStepByName("Properties");
props.setPropertyValue('cookie',"$jsessid");

I put this variable in other requests' headers, but get a new JSESSIONID in response. So I lost session, because a new one is opened.

plaidshirt
  • 5,189
  • 19
  • 91
  • 181

1 Answers1

1

You may have already come across the description of a similar issue at Sending cookie as request header in SOAP UI request for rest web service.

Besides this, you'd need to set the Maintain HTTP session in the option for your test case.

craigcaulfield
  • 3,381
  • 10
  • 32
  • 40