Getting binary data from a GET request

In accessing a web service I have the need to retrieve binary data from a GET request.  Since the ardoHTTP HTTPGet action only deals with text data, I cannot use that.  OutSystems's REST API functionality cannot be made to work with this particular web service since it wraps every request in a session.

I have never used the built-in HTTPRequestHandler functionality.  Does anyone know of an example of using that for a similar purpose?  I also need to add some custom headers to the request.


Thanks.


Dave Schuler

Hello David Schuler, I do not know if I understood your problem correctly, if you can post .oml, or your logic ... But anyway, you may be using the following function to get a binary from a URL.

I hope that helps!

Thank you very much, Herczyk.  Can you point me to an example of the use of that action?  I also need to be able to add a custom header to the request and it is not immediately obvious to me how to do that with the HttpBinaryGet action.

This is an example that I have implemented


Regarding your problem, I believe that ideally your method would return the Path in which the file is, and then you call the HttpBinaryGet with result or make the direct call in the function


I've never done it that way, but it should work.

Unfortunately, that doesn't seem to solve my problem.  Here's a code snippet that shows what I am trying to do with HttpRequestHandler:

I am trying to a) add a header ("Cookie" with a number of values) and b) submit the request.  It is returning an error response.  With this particular service that does not tell me much other than there is something wrong with my request.

As I noted above I need to do a GET and receive a response consisting of binary data.  The binary data means I cannot use ardoHTTP's GET and that REST API requests wrap the requests in sessions means that I cannot use OutSystems REST API requests.  

I can do similar requests to this web service using ardoHTTP GET requests and they work fine.  I do not know how to send custom headers using RichData's HttpBinaryGet and, apparently, I do not know how to add headers using HttpRequestHandler's AddHeader, either.


Dave Schuler