You need to sign in to do that
Don't have an account?
Download remote text file - Premature EOF
I have to call a service to generate a text file. When the text file is ready, I have to download the text file. The text file is pushed as an HTTP download when the URL is used in a browser (I assume due to the content type of application/octet-stream). The problem is that the Apex code breaks on the HTTP.send(), throwing "System.CalloutException: Premature EOF".
Please note that if I call the URL (in Apex) before the file is ready, then I recieve the error message from the server properly (meaning the Apex does not crash and I can see the error message in the debug logs). This suggests to me that I am making the call correctly.
Is there a way to download this file for in-memory processing in Apex?
It seems that the problem was based on the server using Chunking to return the file. When the file is not chunked, it works.