SOAP/API Flashcards
What is SOAP?
Simple Object Access Protocol, it is an XML-based communication architecture that allows different platforms and languages to communicate through HTTP requests.
SOAP services explain the ways to interact with them via WSDL - Web Service Description Language, a language based on XML
What is Allowlisting?
Before we can make any request to an external site (doesn’t matter the kind of service), we need to allowlist it in our org.
- Setup > Security > Remote SIte Settings
and then click on New Remote Site
- Give the URL of the site, give it an alias,
and click Save
- Once this is completed, we’re able to
make an external callout to the service
Mock Classes
- Apex test classes don’t let us make callouts
to external services. - We need to create a response that mocks
the one we would get as a result of the
actual request - For SOAP callouts specifically, we achieve
this by making a second test class that
implements the WebServiceMock
interface - Mock classes must be global or public and
define the doInvoke() method, which has a
void return type, and is also global or public
Test.setMock() method
- Lets the system know which mock we're using - Takes 2 parameters - First is the type of interface our mock implements(WebServiceMock.class when we’re testing SOAP callouts). - Second is the instance of class that implements this interface
Salesforce SOAP API
- Standard Out-Of-the-Box (OOB) SOAP API
that we can use - Allows us to find duplicate records, execute
queries, get information about objects and
fields, perform DML operations, and more
-
RESTful Services
- Stands for Representational State Transfer
- Set of guidelines for API architecture that
has requirements like implementing a
uniform interface across the service and
the server being stateless - Interacting with REST services generally
tends to be easier and more
straightforward than interacting with SOAP
webservices
Salesforce REST API
- Standard REST API that they provide
- Can use it to execute queries, get
information about objects and fields,
perform DML operations, and more
OOB Salesforce APIs
- Bulk API
- Chatter REST API
- User Interface API
- Analytics REST API
- Tooling API
- Metadata API
- Streaming API