I'm writing some Java code to retrieve attachments from Salesforce.
It seems I can query the Attachment object and retrieve the body column, but I'm concerned that I'll blow a limit on the maximum size of a SOAP response.
SF has increased the attachment size limit to 20MB, so its possible that an attachment may be 20MB in size.
Will doing 'select id, body from attachment' blow a response limit? I have a recollection I'm limited to 10MB, but I can't find the documentation that specifically mentions that.
Should I do an HTTP call to the Servlet.Download? url to retrieve the attachments outside of SOAP API? (Assuming I can inject the session id into the request).
Attribution to: Steven Herod
Possible Suggestion/Solution #1
There is no specific limit to the size of a SOAP response from Salesforce, (there is a 50Mb limit on the request size), in general the API tries to shape SOAP responses so that they're not too big (as many client toolkits have no other options other than to deserialize the whole thing in memory), so you'll notice for example your query that returns the body field will only return one row at a time. You should have no issue returning a 20Mb attachment body from a SOAP query call.
If you don't want to take the base64 overhead of fetching attachments via the SOAP api, then consider using the REST API instead, which can return binary data without the base64 overhead, but please don't use Servlet.Download, which is a UI endpoint.
In either case pay attention to HTTP level compression, which on typical attachments can decrease the payload size significantly.
Attribution to: superfell
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1620