Skip to main content
Solved

Using HTTPCaller to PUT binary data writes hexadecimal instead

  • July 31, 2018
  • 3 replies
  • 127 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:

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • 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.


  • Author
  • August 3, 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.

Thanks @takashi, that explains it.

 


david_r
Celebrity
  • June 19, 2020

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.