Skip to Content

TheBlogReaders.com

Salesforce.com Learn & Share

Differences between web service and HTTP callouts from Apex

Be First!

Differences between web service and HTTP callouts from Apex

An Apex callout enables you to tightly integrate your Apex code with an external service. The callout makes a call to an external web service or sends an HTTP request from Apex code, and then receives the response.

Apex callouts come in two flavors.

  1. Web service callouts to SOAP web services use XML, and typically require a WSDL document for code generation.
  2. HTTP callouts to services typically use REST with JSON.

These two types of callouts are similar in terms of sending a request to a service and receiving a response. But while WSDL-based callouts apply to SOAP Web services, HTTP callouts can be used with any HTTP service, either SOAP or REST.

When to Use HTTP & SOAP:

Whenever possible, use an HTTP service. These services are typically easier to interact with, require much less code, and utilize easily readable JSON.

Use SOAP mostly when integrating with legacy applications or for transactions that require a formal exchange format or stateful operations.

About external callouts:
  • SOAP callouts use XML and may use a WSDL for code generation.
  • HTTP callouts typically use JSON but can use XML as well.
  • HTTP callouts are generally easier to work with than SOAP callouts.

SOAP Web Services are commonly used for Enterprise apps that require a formal exchange format or stateful operations.

(3)

Previous
Next

Leave a Reply