A web service is a piece of software that makes itself available over the internet and uses a standardized XML messaging system. XML is used to encode all communications to a web service. For example, a client invokes a web service by sending an XML message, then waits for the corresponding XML response.
There are mainly two types of web services.
- SOAP web services.
- RESTful web services.
Components of Web Services
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery and Integration)
- WSDL (Web Services Description Language)
Soap web services: – SOAP is XML based protocol. It is platform and language independent. By using SOAP, you will be able to interact with other applications designed in different programming languages.
Rest web services: – REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications, it is primarily used to build Web services that are lightweight, maintainable, and scalable. A service based on REST is called a RESTful service.
Difference between SOAP and REST
No. | SOAP | REST |
SOAP stands for Simple Object Access Protocol. | REST stands for Representational State Transfer. | |
SOAP is a XML based messaging protocol. | REST is an architectural style. | |
SOAP permits XML data format only. | REST permits different data format such as Plain text, HTML, XML, JSON etc. | |
SOAP defines standards to be strictly followed. | REST does not define too much standards like SOAP. | |
JAX-WS is the java API for SOAP web services. | JAX-RS is the java API for RESTful web services. | |
SOAP is distributed computing style. | REST is web style (web is also a distributed computing model). |
REST Web Service
REST stands for Representational State Transfer. REST was a term coined by Roy Fielding.
REST is not dependent on any protocol, but almost every RESTful service uses HTTP as its underlying protocol.
Using HTTP Methods for RESTful Services
HTTP Verb | CRUD |
GET | Read |
PUT | Update/Replace |
PATCH | Update/Modify |
DELETE | Delete |
Features of a RESTful Services: – A Restful web service should have following features.
- Representations
- Messages
- URIs
- Uniform interface
- Stateless
- Links between resources
- Caching
Representations
“The focus of a RESTful service is on resources and how to provide access to these resources. A resource can easily be thought of as an object as in OOP. A resource can consist of other resources. While designing a system, the first thing to do is identify the resources and determine how they are related to each other. This is similar to the first step of designing a database: Identify entities and relations”.
“The focus of a RESTful service is on resources and how to provide access to these resources. A resource can easily be thought of as an object as in OOP. A resource can consist of other resources. While designing a system, the first thing to do is identify the resources and determine how they are related to each other. This is similar to the first step of designing a database: Identify entities and relations”.
In Rest we can use any format for representing our resources, as Rest does not put a restriction on the format of representation.
We can use either JSON format or XML format to represent our resource.
If you are building Web services that will be used by Web pages for AJAX calls, then JSON is a good choice. XML can be used to represent more complex resources.
Example 1
JSON representation of a resource
| { "ID": "001", "Name": "Anil Singh", "Email": "xxx.anil354@gmail.com", "Country": "India" } Example 2 |
XML representation of a resource
<Person><ID>001</ID><Name>Anil Singh</Name><Email>
xxx.anil354@gmail.com
</Email><Country>India</Country></Person>
Note:-“The representation should be capable of linking resources to each other. This can be done by placing the URI or unique ID of the related resource in a representation”.
Message
“The client and service talk to each other via messages. Clients send requests to the server, and the server replies with a response. Apart from the actual data, these messages also contain some metadata about the message”.
“The client and service talk to each other via messages. Clients send requests to the server, and the server replies with a response. Apart from the actual data, these messages also contain some metadata about the message”.
Caching
“Caching is the concept of storing the generated results and using the stored results instead of generating them repeatedly if the same request arrives in the near future. This can be done on the client, the server, or on any other component between them, such as a proxy server. Caching is a great way of enhancing the service performance, but if not managed properly, it can result in client being served stale results”.
“Caching is the concept of storing the generated results and using the stored results instead of generating them repeatedly if the same request arrives in the near future. This can be done on the client, the server, or on any other component between them, such as a proxy server. Caching is a great way of enhancing the service performance, but if not managed properly, it can result in client being served stale results”.
Statelessness
“A RESTful service is stateless and does not maintain the application state for any client. A request cannot be dependent on a past request and a service treats each request independently”.
“A RESTful service is stateless and does not maintain the application state for any client. A request cannot be dependent on a past request and a service treats each request independently”.
Uniform Interface
“The uniform interface constraint is fundamental to the design of any REST service. The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently”.
“The uniform interface constraint is fundamental to the design of any REST service. The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently”.
Links between resources
“A resource representation can contain links to other resources like an HTML page contains links to other pages. The representations returned by the service should drive the process flow as in case of a website. When you visit any website, you are presented with an index page. You click one of the links and move to another page and so on. Here, the representation is in the HTML documents and the user is driven through the website by these HTML documents themselves. The user does not need a map before coming to a website. A service can be (and should be) designed in the same manner”.
“A resource representation can contain links to other resources like an HTML page contains links to other pages. The representations returned by the service should drive the process flow as in case of a website. When you visit any website, you are presented with an index page. You click one of the links and move to another page and so on. Here, the representation is in the HTML documents and the user is driven through the website by these HTML documents themselves. The user does not need a map before coming to a website. A service can be (and should be) designed in the same manner”.
HI,
ReplyDeleteThanks for sharing the great information. It helps to all the basic level to higher level of Salesforce
Hello,
ReplyDeleteThe information provided is precise and factual. We also render Salesforce Interview Questions for Salesforce Learners. which may help you gain professional knowledge on the subject and be prepared well in advance to face the actual Interview.
Hi,
ReplyDeleteThis post is really nice and informative. The explanation given is really comprehensive and informative... kepp updating us with latest ,SalesForce interview questions
Thank You
Hariprasad
A web service is a technique of communication between two electronic devices over the World Wide Web. XML technologies, SOAP, WSDL, and UDDI are web service technologies. XML technologies are extensible markup language and base XML for document. SOAP is Simple Object Access Protocol and it is a simple way to send document.
ReplyDeleteCommunity Policing test bank & solutions manual
ReplyDeleteSalesforce
Salesforce - Get the sales and customer-support activities information about customers through Salesforce, enabling multiple groups to have a unified view of the customer.
to get more - https://augustiqconsulting.com/sales-force/
This post is really Interesting and informative. thank you for sharing this valuable Q&A
ReplyDeleteSalesforce
Thanks for the informative Content. I learned a lot here. Keep sharing more like this.
ReplyDeleteSalesforce Developer Training in Chennai
Learn Salesforce Online
Thank you for the useful information. Very helpful, Share more.
ReplyDeleteAsp.NET
Framework