Best Practices and limitations for Salesforce Apex Callouts

Varun   Varun 1247 Views
Common error and limitations for WSDL-to-Apex

  • External schema reference import
  • Importing WSDL size limit - 1MB ( utilize middle ware and just consume the middleware wsdl or remove not required wsdl components)
  • A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call.
  • Timeout limitation, can be set for each callout : The minimum is 1 millisecond and the maximum is 120,000 milliseconds.
  • SOAP 1.2 is not supported. Use SOAP UI tool to review the bindings
  • SOAP UI we can validate WS-I compliance

Example to set callout timeout limitation:

docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds
HttpRequest req = new HttpRequest();
req.setTimeout(2000); // timeout in milliseconds