Sidebar

Can you programmatically reset a channel's cookies?

0 votes
389 views
asked Aug 15, 2018 by (140 points)
In having to work with an API that involved putting a security token into a Cookie before sending or retrieveing data from it I ran into issues with the cookie maintating, this is fine for the life of the token. When it came to resetting it though I couldn't find anywhere to do it but in the Gui interface for the channel. I also ran into a weird issue with parameter maps not setting properly to the outbound requests after having the cookie in place.

2 Answers

0 votes

QIE does automatically store and manage cookies on the webservice connections. There is an option to disable cookies:

Once you uncheck that you can add the cookies manually as an http header:

parameterMap.put("http.header.Cookie", "putYourCookie(s)Here");

Just keep in mind by disabling the "Enable cookies for this web service" option you will need to manage the cookies in your channel.

answered Aug 15, 2018 by brandon-w-8204 (33,170 points)
0 votes

When the "Enable cookies for this web service" is checked, QIE will extract any SET-COOKIE HTTP headers in the response and store these values in a cookie jar.  You are correct, that you can manually clear the cookies by clicking the button.

As far as programmatically clearing the cookies, we do not have a call to clear them.  You could try adding a blank cookie header in your webservice call.  This will override the cookies QIE would have sent.  Without sending the expected cookie, the server will likely return new SET-COOKIE headers on the reseponse which would update the internal cookie jar for the web service. 

Note below that it will add an entry in the parameterMap of ("http.header.Cookie", " ")

Add a Cookie HTTP Header

Does that work for you?

answered Aug 15, 2018 by mike-r-7535 (13,830 points)
...