Apex Web Services

Salesforce Apex Web Services and Its Different Types

A Web Service can be understood extra clean manner with beneath….     

  • It's a consumer server software.    
  • Method of communication between gadgets over the community.    
  • It's a collection of standards/protocols for changing data between two gadgets or applications.  
  • It's a software gadget for the interoperable system to system information exchange.  

So, web services are a language impartial way of conversation.  

Types of Web Services

We have 2 varieties of Web Services.  

  1. SOAP Web Services.  
  2. RESTful Web Services

dont miss out iconDon't forget to check out: Salesforce Developer Tutorial - How and When to Use Apex Managed Sharing

SOAP Web Services

SOAP affords the envelope for sending Web Services messages over the Internet/Internet. It is part of the set of requirements particularly via the W3C. SOAP is an opportunity for Representational State Transfer (REST) and JavaScript Object Notation (JSON) 

The SOAP envelope includes two components:  

  1. A non-compulsory header imparting information on authentication, encoding of records, or how a recipient of a SOAP message has to procedure the message.  
  2. The frame that contains the message. These messages can be described the use of the WSDL specification.  

SOAP usually uses HTTP, however other protocols together with Simple Mail Transfer Protocol (SMTP) can be used. SOAP may be used to change whole documents or to name a remote method.  

Advantages 

  1. SOAP defines its personal safety called WS Security.  
  2. SOAP web offerings may be written in any programming language and achieved on any platform.  

Disadvantages:  

  1. SOAP makes use of XML layout that ought to be parsed to be examined. It defines many standards that need to be accompanied whilst developing SOAP programs. So, it's miles gradual and consumes greater bandwidth and sources.  
  2. SOAP uses WSDL and doesn’t have some other mechanism to discover the carrier.  

RESTful Web Services

REST is used to construct Web services that are lightweight, maintainable, and scalable in nature.  

The underlying protocol for REST is HTTP, which is a simple web protocol. REST stands for Representational State Transfer  

Restful Methods  

Understand it by the pictorial diagram below:  

When the client makes any request to this internet provider, it may specify any of the ordinary HTTP verbs of GET, POST, DELETE and PUT. Below is what might happen If the respective verbs were sent through the consumer.  

POST – This could be used to create a new employee using the RESTful net service  

GET – This might be used to get a listing of all personnel the use of the RESTful net carrier   

PUT – This might be used to replace all personnel with the use of the RESTful internet carrier    

DELETE – This could be used to delete all personnel from the use of the RESTful web service  

The following movements would have their respective meanings.  

POST – This would now not be applicable given that we are fetching data of employee 1 which is already created.  

GET – This would be used to get the info of the employee with Employee no as 1 the usage of the RESTful web carrier  

PUT – This could be used to update the info of the employee with Employee no as 1 using the RESTful internet service  

DELETE – This is used to delete the details of the worker with Employee no as 1  

dont miss out iconCheck out another amazing blog by Rajesh here: Data Quality Control Using Validation Rules | Salesforce Guide

Finally, Differences……. 

S.No  SOAP   REST 
1  SOAP is a protocol.  REST is an architectural style. 
2  SOAP stands for Simple Object Access Protocol.  REST stands for Representational State Transfer. 
3  SOAP can’t use REST because it’s far from protocol.  REST can use SOAP net services due to the fact it's far a concept and may use any protocol like HTTP, SOAP. 
4  SOAP uses services interfaces to expose the business good judgment.  REST makes use of URI to show commercial enterprise logic. 
5  SOAP defines requirements to be strictly observed.  REST does not now outline too many requirements like SOAP. 
6  SOAP defines standards to be strictly accompanied.  REST does now not outline too many requirements like SOAP. 
7  SOAP calls for greater bandwidth and useful resources than REST.  REST calls for less bandwidth and useful resources than SOAP. 
8  SOAP defines its personal protection.  RESTful net services inherit security measures from the underlying delivery. 
9  SOAP lets in XML information layout best.  REST allows specific information layout together with Plain textual content, HTML, XML, JSON and so on. 
10  SOAP is much less preferred than REST.  REST greater preferred than SOAP. 

 

Responses

Popular Salesforce Blogs