How do I get information out of the header in a response?
Using ClientBuilder, I get the successful response, but the piece of data I need is in the header. Specifically the Location field.
This is what it looks like in response-data-received.txt.
HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 286
Content-Type: text/xml; charset=utf-8
Expires: -1
Location: This_is_the_information_you_need
X-Content-Type-Options: nosniff
Server: WWW Server/1.1
X-XSS-Protection: 1; mode=block
Date: Mon, 29 Apr 2019 21:17:50 GMT
<?xml version='1.0' encoding='utf-8'?>
I can cast the response, which shows up as a WidgetHandle, to LONGCHAR but that only returns the XML part. Which is not what I need.
DEFINE VARIABLE hxmldoc AS HANDLE NO-UNDO.
hxmldoc = cast(oResponse:Entity, WidgetHandle):VALUE.
hxmldoc:SAVE ("longchar", cRsp).
Thank you,
Mike
Just came across this:
knowledgebase.progress.com/.../How-to-read-response-headers-with-the-HTTP-Client
That works for what I need.
A bit too fast, oResponse:GetHeader("Location") returns an OpenEdge.Net.HTTP.HttpHeader object which has a Name and Value property.
So, the location you're looking for is:
oResponse:GetHeader("Location"):Value
Just came across this:
knowledgebase.progress.com/.../How-to-read-response-headers-with-the-HTTP-Client
That works for what I need.
use: oResponse:GetHeader("Location").
A bit too fast, oResponse:GetHeader("Location") returns an OpenEdge.Net.HTTP.HttpHeader object which has a Name and Value property.
So, the location you're looking for is:
oResponse:GetHeader("Location"):Value
Thank you Bronco.
I had just found this too, knowledgebase.progress.com/.../How-to-read-response-headers-with-the-HTTP-Client