StevenC
11 years agoContributor
Clearing request headers
I am testing a system where we have multiple client configurations for the web services, some of which require authentication others do not. I have my framework set up so that whether security is enabled or disabled is configurable with a single switch and that is all working.
The problem I am having is when I switch from a security on to a security off configuration I want to be able to remove the authentication headers from the soap calls automatically in groovy (otherwise the request fails for a bad session token) .
I have tried several incarnations of setting them to null or to an empty StringToStringMap/StringToStringsMap and they all failed as well as the following...
which failed because it could not determine whether the input was a StringToStringsMap or a StringToStringMap
So how do I remove all the headers from a soap call using groovy?
The problem I am having is when I switch from a security on to a security off configuration I want to be able to remove the authentication headers from the soap calls automatically in groovy (otherwise the request fails for a bad session token) .
I have tried several incarnations of setting them to null or to an empty StringToStringMap/StringToStringsMap and they all failed as well as the following...
pfdRequest.setRequestHeaders(pfdRequest.getRequestHeaders().clear())
which failed because it could not determine whether the input was a StringToStringsMap or a StringToStringMap
So how do I remove all the headers from a soap call using groovy?