When should architects select the SOAP API over the REST API for enterprise Salesforce integrations?
Answer
Basics: SOAP exchanges XML envelopes over HTTP. A WSDL describes operations and data types, so tools generate client stubs automatically. Salesforce offers two WSDLs: Enterprise (strongly typed to your org's schema, tied to your org) and Partner (loosely typed, generic across orgs, good for ISVs and tools).
How it works:
- Download the WSDL from Setup > API (Enterprise, Partner, Metadata, Apex-class-specific WSDL).
- Generate client stubs in Java, .NET or an ESB tool.
- Authenticate using an OAuth access token passed as the session ID in the
SessionHeader. The username/passwordlogin()call is being retired, so verify its status in current release notes and migrate to OAuth. - Call operations such as
create,update,upsert,delete,query,queryMore,convertLead,merge,describeSObjects. - The response is an XML result array; each record has a
successflag and errors.
Advanced / deep dive: Real reasons to pick SOAP: (a) existing middleware or ERP connectors only speak WSDL; (b) compile-time type safety with the Enterprise WSDL; (c) SOAP-only features and calls (some convertLead/merge style operations also exist in REST now, so check); (d) the Metadata API and the Apex SOAP web services are SOAP. Drawbacks: verbose XML, heavier parsing, the Enterprise WSDL must be regenerated when the schema changes, and clients break on field deletions. Transaction control is the same as REST: each call handles up to 200 records, with the for all-or-nothing behavior. There is no distributed two-phase commit across systems. Both APIs use the same limits, sharing and FLS.