How to download a data stream from an HTTP URL as a binary object

Question

How can I download files from a Web Service using HTTP and receive a binary data stream?

 

Answer

Use a tFileFetch component configured with the HTTP protocol and enable the Use cache to save resource option.

 

The received data stream bytes are stored in a java.io.InputStream object, which you can get using the following globalMap key:

(java.io.InputStream)globalMap.get("tFileFetch_1_INPUT_STREAM")

 

You can then use this object as you wish.

Version history
Revision #:
2 of 2
Last update:
‎12-06-2017 04:10 PM
Updated by:
 
Labels (2)
Contributors