Salesforce: Web Services
SOAP Web Services
SOAP (Simple Object Access Protocol) is a protocol-based web service that uses XML for messaging. Here are some key points about SOAP web services:
- Protocol-based: SOAP is a strict XML-based messaging protocol.
- Contract-driven: Requires a WSDL (Web Services Description Language) file that defines operations, types, and bindings.
- Features:
- Strong typing and formal contracts
- Built-in error handling via SOAP faults
- Extensible headers (security, transactions, etc.)
- Use cases: SOAP Web Services are commonly used for enterprise integrations, legacy systems, banking applications, and scenarios that require strict standards and reliability.
REST Web Services
REST (Representational State Transfer) is an architectural style that is not protocol-based. It focuses on exposing resources through URLs and typically uses JSON or XML payloads. Here are some key points about REST web services:
- Architectural style: REST is not a protocol but a design style.
- Resource-driven: Exposes resources via URLs, typically using JSON or XML payloads.
- Features:
- Lightweight and faster than SOAP
- Uses standard HTTP verbs (GET, POST, PUT, DELETE)
- Easier to consume with modern clients (JavaScript, mobile apps, etc.)
- Use cases: REST Web Services are suitable for modern APIs, mobile/web applications, and integrations where simplicity and speed are important.
Salesforce Context
Salesforce supports both SOAP and REST web services for integration and development. Here’s how Salesforce integrates with these web service types:
- SOAP: Salesforce allows the creation of Apex classes with webService methods which can be consumed via WSDL.
- REST: Salesforce supports Apex classes annotated with @RestResource, which can be consumed via HTTP endpoints returning JSON.
APIs in Salesforce
Salesforce provides various APIs to help developers interact with Salesforce programmatically. These APIs enable integration with external systems, automate business processes, and customize Salesforce functionalities.
Callouts
Salesforce callouts allow the execution of HTTP requests to external services from Apex code. These callouts are essential for integrating Salesforce with external APIs, sending data to third-party services, or fetching information from external sources.
