function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Max SOAP message size and other integration related questions


I am trying to integrate one of our applications with SalesForce. I am quite new with SaleForce and I have basic knowledge of Apex and Visualforce, so please have mercy.

My preference would be to push data to our application (either REST/SOAP). I've learned that REST has a limit of 100kB on message body. Here are my questions:

1) Is there similar limitation on SOAP?
2) What other options are there to integrate with external applications. I understand I could use SF WS API and pull data when we need. What discourages me is 2,000 record limit. There is instance when we would need to send 10,000 records and I want to keep it sweet and simple for now. I want to keep our system API agnostic from SF.
3) Is it possible to open TCP/IP connection from Apex?

Any suggestions are welcome. I searched Apex documentation but couldn't find anything about SOAP size limit (there was something about 52MB but that was for incoming SOAP from external system, I guess).


The current limitation on message size is within Apex when making callouts (external web service call) and as you noted, it is 100 kb limit on both the request and response. This is for both HTTP/REST and SOAP transactions through Apex.

The Web Service API doesn't have the same limits. You mention a concern over a 2,000 record limit. I am assuming you are referring to the queryResult limit of a SOQL query. That is only a limit per batch. But you can easily get the next 2,000 records and so on for any query that returns thousands of records. See documentation on SOQL and API Query here:

Secondly, you can insert/update/delete data with the Web Services API in batches of 200. Meaning, in a single SOAP request, you can include 200 records. So your integration would just have to include some logic to batch records into groups of 200 and iterate through them per api request.

I hope this helps.

Thank you for your response.

We need to transfer approximately 2MB of data. Some of it being 10000 records. It seems like using SF WS API is the only option that we have.

Here is what we have to do:
1) Apex code makes REST/SOAP request to our system.
2) Our system fetches data from SF using SF WS API. We will have to put extra code to handle batching.
3) We send response back to Apex code.

One of the reasons I was trying to avoid using SF WS API because of authentication. We have to handle authentication on both sides now.

1) Is there easy way to reuse SF session from Step 1? So our external system does not have to provide credentials again?
2) Is it good practice to do that?
3) Should we create separate account for our external system to fetch the data?

A lot of questions. Thank you once more for all your help,

I would recommend maintaining a separate SFDC user for your Web Service integrations.
If you re-used the sessionId from the user who is logged in and initiated this process, that sessionId will inherit the same data permissions. Meaning, if the user can't modify the data as the integration process requires, it won't help to pass that sessionId back to your web service. So to avoid any issues with user permissions (unless you want to enforce them in your integration), I recommend an integration user.

Thanks, that helps a lot.