Advanced 25 min read

SOAP Web Services Overview

By the end of this lesson, you'll be able to:

  • Explain what SOAP is and how it differs from a REST/JSON callout
  • Recognize a WSDL and its role in generating Apex classes
  • Understand when SOAP still appears in real integration work

Prerequisites: "REST Resources in Apex (@RestResource)"

SOAP vs REST, at a glance

REST (this module\'s other lessons) SOAP
Data format Usually JSON Always XML (Lesson 3\'s DOM classes)
Contract Informal (API documentation) Formal — a WSDL file defines every operation precisely
Flexibility Lightweight, flexible Rigid, but strongly typed and validated

SOAP predates REST's current dominance and remains common specifically in older enterprise systems — banking, insurance, and government integrations especially.

What a WSDL does

A WSDL (Web Services Description Language) file is a formal, machine-readable contract describing every operation a SOAP service offers, its parameters, and its expected responses. Salesforce can generate a complete set of Apex classes directly from a WSDL file (via Setup) — turning a SOAP service's contract into ready-to-use Apex classes automatically, rather than hand-writing the XML request/response parsing yourself.

Using a generated SOAP class

// After generating classes from a WSDL, calling a SOAP service
// looks almost like calling a regular Apex method:
ExternalBankingService.BankingPort service = new ExternalBankingService.BankingPort();
ExternalBankingService.AccountBalanceResponse response = service.getAccountBalance('ACC-123');

This is the real value of WSDL-generated classes: once generated, calling a SOAP service reads almost like a normal method call (Module 9) — the generated classes handle the underlying XML request/response construction entirely behind the scenes.

Exercise

As a comment, explain what a WSDL file is and what generating Apex classes from it actually saves you from doing manually.

Show hint

Think about what Lesson 3's DOM.Document parsing would otherwise require.

APEX

SOAP Web Services Overview Quiz

1. What data format does SOAP always use?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

SOAP is an older, more rigid web service standard, XML-based and defined by a formal contract (a WSDL) — genuinely less common in new integrations, but still worth recognizing.