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 #:
3 of 3
Last update:
‎09-29-2018 12:15 AM
Updated by:
 
Labels (3)