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.

Written by 

I am Sakthivel Madesh, a certified Salesforce Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 13x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply