SFDC Web-Service
We can implement Web-service using two different approaches. Salesforce
Apex supports both the ways to consume & produce the web-service.
1.
SOAP web-service
2.
RestFul Web-Service
(SOAP
and WSDL / HTTP services (RESTful services))
Salesforce terminology
Apex Web Services (SOAP based)
is involved in creating a web service that a client
can invoke (Produce)
Apex Callouts (HTTP/RestFull
Callouts)
is invoking an external web service (Consume)
Difference between SOAP based callouts and RestFull Callouts
What
are Callouts / Make Callouts to External Services 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.
So you are probably asking yourself right now, “Which one should I
use?” Whenever possible, use an HTTP service. These services are typically
easier to interact with, require much less code, and utilize easily readable
JSON. All the “cool kids” have been switching to REST services over the last
couple of years.
Web-Service Security Controls
1.
Remote Site Restriction
for 'Callouts'
Before any Apex
callout can call an external site, that site must be registered in the Remote
Site Settings page, or the call will fail. The platform, by default, prevents
calls to unauthorized network addresses.
Click on
Setup
ð
Security Controls
ð
Remote Site Settings
This page displays a list of any remote sites already registered and
provides additional information about each site, including remote site name and
URL.

2.
Port Restriction
For security reasons, the platform restricts the outbound ports you may
specify to one of the following:
80: This port only
accepts HTTP connections.
443: This port only
accepts HTTPS connections.
1024–66535
(inclusive): These ports accept HTTP or HTTPS connections.
Please make sure to add your external site domains to the Remote Site
Settings prior to invoke any third party web services.
