Solved

Using HTTPCaller to PUT binary data writes hexadecimal instead

  • 31 July 2018
  • 3 replies
  • 25 views

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:

icon

Best answer by takashi 1 August 2018, 00:38

View original

3 replies

Userlevel 2
Badge +17

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.

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.

 

Userlevel 4

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.

Reply