Callout Limits and Limitations

The following limits and limitations apply when Apex code makes a callout to an HTTP request or a Web services call. The Web services call can be a SOAP API call or any external Web services call.

Setting Callout Timeouts

The following example sets a custom timeout for Web services callouts. The example works with the sample WSDL file and the generated DocSamplePort class described in Generated WSDL2Apex Code. Set the timeout value in milliseconds by assigning a value to the special timeout_x variable on the stub.
docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds

The following is an example of setting a custom timeout for HTTP callouts:

HttpRequest req = new HttpRequest();
req.setTimeout(2000); // timeout in milliseconds
© Copyright 2000–2015, inc. All rights reserved.
Various trademarks held by their respective owners.