System.CalloutException: Read timed out error in Salesforce

System.CalloutException: Read timed out error in Salesforce

The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 120,000 milliseconds.

HttpRequest httpReq = new HttpRequest();
httpReq.setTimeout( 2000 ); // 2000 milliseconds(2 seconds)

The maximum timeout can be 2 minutes only.

Note:
Use the Continuation class in Apex to make a long-running request to an external Web service.

Leave a Reply