Skip to main content
Solved

Using HTTPCaller to PUT binary data writes hexadecimal instead


When I use a HTTPCaller to PUT anything fme_binary, the hexadecimal representation as visible in the data inspector is included in the request body, instead of the actual raw bytes. This results in a bunch of unreadable files on the other end.

If I do the put request using the same attribute with a PythonCaller as below everything works fine. The binary data are pngs serialized through a RasterExtractor directly before.

Has anyone run into a similar issue before?

So, this works:

r = requests.put(

 

url=url,

 

data=body,

 

headers={

 

'Content-Type': 'image/png',

 

'x-ms-blob-type': 'BlockBlob'})

This doesn't:

Best answer by takashi

Hi @bleuminkgeo, I think the transformer supports uploading only a file or a string value. It doesn't seem to support uploading a raw bytes from an fme_binary type attribute.

"Upload Data: This parameter identifies the type of data that will be uploaded. The transformer can upload a file, a string value, or a multi-part combination of file and string values." -- HTTPCaller Help

A workaround is, write the raster feature into a file with a FeatureWriter, then upload the file with the HTTPCaller.

View original
Did this help you find an answer to your question?

3 replies

takashi
Influencer
  • Best Answer
  • July 31, 2018

Hi @bleuminkgeo, I think the transformer supports uploading only a file or a string value. It doesn't seem to support uploading a raw bytes from an fme_binary type attribute.

"Upload Data: This parameter identifies the type of data that will be uploaded. The transformer can upload a file, a string value, or a multi-part combination of file and string values." -- HTTPCaller Help

A workaround is, write the raster feature into a file with a FeatureWriter, then upload the file with the HTTPCaller.


takashi wrote:

Hi @bleuminkgeo, I think the transformer supports uploading only a file or a string value. It doesn't seem to support uploading a raw bytes from an fme_binary type attribute.

"Upload Data: This parameter identifies the type of data that will be uploaded. The transformer can upload a file, a string value, or a multi-part combination of file and string values." -- HTTPCaller Help

A workaround is, write the raster feature into a file with a FeatureWriter, then upload the file with the HTTPCaller.

Thanks @takashi, that explains it.

 


david_r
Celebrity
  • June 19, 2020
takashi wrote:

Hi @bleuminkgeo, I think the transformer supports uploading only a file or a string value. It doesn't seem to support uploading a raw bytes from an fme_binary type attribute.

"Upload Data: This parameter identifies the type of data that will be uploaded. The transformer can upload a file, a string value, or a multi-part combination of file and string values." -- HTTPCaller Help

A workaround is, write the raster feature into a file with a FeatureWriter, then upload the file with the HTTPCaller.

Just adding that this is still the case in FME 2020.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings