Reading HTTP Response header

studio
http

#1

Hello,

Any one come across reading the response headers after using the HTTPRequest activity? Basically the use case is to post the file and get the resource URI from the response location header.

I do not see any explicit option available in HTTP Request activity to read the HTTP Response headers. I do see the property output only for statuscode and response body.

Any thoughts?

Regards,
Balram


#2

Not exactly sure, but it looks like retrieving headers is not possible via httprequest activity.

Have you tried other activities? For some reason they doesn’t get invoked for me, but give a shot.

image

If you are using 2017.1, i think you could use code activity to fetch the response headers.Something like below:

objRequest  = CType(System.Net.WebRequest.Create(URL), System.Net.HttpWebRequest)
objRequest.ContentType = "text/xml; charset=utf-8"
objRequest.Accept = "application/xml"
objRequest.Method = "POST"
objRequest.Timeout = 10000
encoding = New System.Text.ASCIIEncoding()
bytes = encoding.GetBytes(reqInfo)
objRequest.ContentLength = bytes.Length
requestStream = objRequest.GetRequestStream()
requestStream.Write(bytes, 0, bytes.Length)
objResponse = CType(objRequest.GetResponse(), System.Net.HttpWebResponse)
uri=objResponse.Headers("xyz")

#3

Hi,
Thank you for the response. I have tried with the HTTPSend and HTTPPost both are giving below error.
image
I will check the code activity, basically the request should go as form data with file type and other parameters.

Regards,
Balram.