Solved

Save binary formats

  • 4 January 2016
  • 6 replies
  • 52 views

Badge +21

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?

icon

Best answer by sigtill 5 January 2016, 08:16

View original

6 replies

Userlevel 5

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

Userlevel 4
Badge +26

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.

Badge +21

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?

Userlevel 5

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.

Userlevel 4
Badge +13

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.

Badge

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...

Reply