Thanks for your replies.
gcubed: I'm already leveraging the code you shared in earlier posts around invoking servicenow. I realized my problem is with maintaining sessions rather than the HTTPConnection object. In this third party application which I have, I need to first make a rest call to authenticate URL, get the session ID/token and send it as a parameter to the second rest call to object creation URL. When I use the session ID to create the object, it says the session ID is invalid. This is because it creates a new session every time I call the url.openConnection().
I tried to use CookieManager to maintain the session and it works great in Java, but in GEL it doesn’t seem to work.
<core:new className="java.net.CookieManager" var="cManager">
</core:new>
<core:expr value="${cManager.setCookiePolicy(java.net.CookiePolicy.ACCEPT_ALL)}"/>
<core:expr value="${java.net.CookieHandler.setDefault(cManager)}"/>
Any ideas on how to manage HTTP sessions in GEL?
Thanks,
Leo.