+ Start a Discussion
Nishar Babu 9Nishar Babu 9 

How to retrieve body of a large attachment using SOAP client

I am trying to retrieve the body of an attachment from SOAP API and facing an issue with the response size of my SOQL query. The query which I am using is,
queryclient.retrieve(header, null, null, null, "Name, Id, Body, BodyLength", "Attachment", ids, out sObjects); 

This works fine in case of a smaller size attachment (around 500kb). When the size of the file is around 900kb or above, I am receving the following error.
"The maximum message size quota for incoming messages (999999) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."

I also tried fetching this attachment body from Rest Explorer and received the following error.
Regex too complicated
Error is in expression '{!execute}' in component <apex:commandButton> in page restexplorer: (System Code)
Class.RestResponseInstrumenter.Insturmentation.instrument: line 15, column 1
Class.RestResponseInstrumenter.instrument: line 52, column 1
Class.RestExplorerController.execute: line 92, column 1


Can you please let me know how to fetch a large attachment body from Salesforce? I need this to be done through SOAP or REST API and not APEX. Thanks.

Regards,
Nishar