That in no way shape or form helps me add or remove the authentication token to/from the soap request dynamically at runtime.
The calls are not using authentication in the soap calls, there is an explicit open session soap call that returns an authentication cookie that needs to be attached to the headers of every subsequent soap call. Environments will not dynamically determine whether to run openSession, nor will they extract the returned token and attach it to every subsequent soap call.
To give you an idea what I am talking about here is the code that attaches the headers...
def step = testRunner.runTestStepByName( "openSession")
def authorizationHeader = new StringBuilder()
def credentials = new StringBuilder()
def cookieValue = testRunner.testCase.testSteps["openSession"].testRequest.response.responseHeaders["Set-Cookie"][0]
authHeaders.put("Cookie", cookieValue.toString())
authorizationHeader.append("License")
authorizationHeader.append(" ")
credentials.append(testRunner.testCase.testSuite.project.getPropertyValue( "validLicensedUserLogin" ))
credentials.append(":")
credentials.append(testRunner.testCase.testSuite.project.getPropertyValue( "validCustomerLicenseGuid" ))
byte[] bytes = Base64.encodeBase64(credentials.toString().getBytes())
authorizationHeader.append(new String(bytes))
authHeaders.put("Authorization", authorizationHeader.toString())
So how do I remove them dynamically? I can't set them to Null, and I can't set them to an empty stringtostrings object so what can I do?