How i can turn off automatic redirect of HTTP client?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2017 02:44 AM
Hi All.
We faced with unexpected behavior and want to ask for advice.
We need to import data from the site. To get that information we should call PHP script, but we should be authorized first. Authorization performed by another PHP script, which generates the cookie and redirects to main page of the site.
When we try to send REST request by ARC - it returns empty body and 9 headers (include Set-Cookie and Location). From that response we can take cookie and can make call for data.
We try to make call from ServiceNow. Fist we use RESTMessageV2 object. We provided the same header and parameters of POST request. But in the response object we receive result with performed redirect to main page of the site. And there is no cookies in the response.
Then we try to use GlideHTTPClient - result was the same. Body of the response contained data of main page, no cookies in header. Also we try to set setInstanceFollowRedirects to false, but there is no success.
So we wonder if there any way to stop automatic redirecting of HTTP client? Or may be HTTP client storing Cookies somewhere and there is a chance to get them?
Many thanks in advance.
- Labels:
-
Integrations
-
Scripting and Coding
- 3,829 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2020 09:22 PM
Hi.
Currently, we`ve solved the situation after consultation with HI.
The solution is to create sys_property glide.http.redirect_with_auth and set to "true". After setting of the property HttpClient started to process correctly instruction setFollowRedirect(false) and we`ve got the response with the code 302.
That works for us.
As far as I can see you have additional "s" in the name of the method. It could be the cause of your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2020 02:53 AM
Hi
