Skip to main content
Solved

Save binary formats


sigtill
Supporter
Forum|alt.badge.img+24

When using HTTPCaller you can get a binary respons, for instance a PDF with _headers{13}.value (string): application/pdf . If you "Save Response Body To : FILE" the file gets created ok. However if you choose Save Response Body to: Attribute - and then writes this data with a AttributeFileWriter or a textfilewriter it does not get saved as PDF. Is there a "Generic Binary writer" that writes in similar way as the HTTPCaller does depending on the application/pdf type?

Best answer by sigtill

Extension can be set OK - changing to binary I already tried - HOWEVER I forgot to set the HTTPCaller to response type to binary - now it works with the AttributeWriter.

Thank you @david_r

Now for the last part - is it possible to use the WRITER to Text File to behave in the same way?

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

6 replies

david_r
Celebrity
  • January 4, 2016

For the AttributeFileWriter, did you try setting the character encoding to fme-binary?

Or is it the filename extension that is the issue here?

David


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • January 4, 2016
david_r wrote:

For the AttributeFileWriter, did you try setting the character encoding to fme-binary?

Or is it the filename extension that is the issue here?

David

I'm with you here. I pointed a HTTPCaller to a PDF file and wrote _response_body to a file with the AttributeFileWriter. When the AFW encoding was set to System then the file wouldn't open. However, it did open when set to fme-binary.


sigtill
Supporter
Forum|alt.badge.img+24
  • Author
  • Supporter
  • Best Answer
  • January 5, 2016

Extension can be set OK - changing to binary I already tried - HOWEVER I forgot to set the HTTPCaller to response type to binary - now it works with the AttributeWriter.

Thank you @david_r

Now for the last part - is it possible to use the WRITER to Text File to behave in the same way?


david_r
Celebrity
  • January 5, 2016
sigtill wrote:

Extension can be set OK - changing to binary I already tried - HOWEVER I forgot to set the HTTPCaller to response type to binary - now it works with the AttributeWriter.

Thank you @david_r

Now for the last part - is it possible to use the WRITER to Text File to behave in the same way?

Have you tried the DATAFILE writer? It seems generic and it does have a binary mode.


fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • January 7, 2016
david_r wrote:

Have you tried the DATAFILE writer? It seems generic and it does have a binary mode.

Yes, DATAFILE was invented to do Binary. Should work.


jpvo
Participant
Forum|alt.badge.img+1
  • Participant
  • January 7, 2016

I was trying to write a zip file from a BLOB in an ORACLE database. The AttributeFileWriter didn't work when the BLOB was read using an SQL executor and produced a corrupted file. On the other hand, when the BLOB is read using a proper ORACLE reader, the AttributeFileWriter writes the file perfectly.

Any idea on what could cause this and how I could manage to write my file when the BLOB is read from SQLExecutor?

Thanks, I hope it's not off topic...


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