Friday, June 1, 2012

HTTP Callout


An Apex callout enables you to tightly integrate your Apex with an external
service by making a call to an external Web service or sending a HTTP request
 from an Apex script and then receiving the response. Apex provides integration
with Web services that utilize SOAP and WSDL, or HTTP services (RESTful
services).

  1. Adding Remote Site Settings
  2. SOAP Services: Defining a Class from a WSDL Document
  3. Invoking HTTP Callouts
  4. Using Certificates
    • CA-Signed Certificate
    • Create Self-Signed Certificate

Callout Limit
The following limits apply when an Apex script makes a callout to an HTTP request or a Web services call. The Web services call can be a Web services API call or any external Web services call.
• A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.
• The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 60 seconds. See the following examples for how to set custom timeouts for Web services or HTTP callouts.
• The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction?
docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds

No comments:

Post a Comment