Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Salesforce System.CalloutException: Read timed out error

Be First!

Salesforce System.CalloutException: Read timed out error

below is the sample code, we can set the timeout during the callout:
The default timeout is 10 seconds.
The minimum is 1 millisecond
The maximum is 120 seconds (2minutes).

and also you can catch the CalloutException; from the Apex Web Services and Callouts:

try {
//Execute web service call here
HTTPResponse res = http.send(req);
res.setTimeout(2000); // timeout in milliseconds
//Helpful debug messages
System.debug(res.toString());
System.debug(‘STATUS:’+res.getStatus());
System.debug(‘STATUS_CODE:’+res.getStatusCode());
} catch(System.CalloutException e) {
//Exception handling goes here…. retry the call, whatever you want to capture the Exception error during the callout failure
}

Reference:
https://developer.salesforce.com/page/Apex_Web_Services_and_Callouts#HTTP_Code_Sample

(1575)

Previous
Next

Leave a Reply