Restful Web Service
Restful Web Service is a lightweight, maintainable, and scalable service that is built on the REST architecture. Restful Web Service, expose API from your application in a secure, uniform, stateless manner to the calling client.
Restful mostly came into popularity due to the following reasons:
- Heterogeneous languages and environments – This is one of the fundamental reasons which is the same as we have seen for SOAP as well.
- It enables web applications that are built on various programming languages to communicate with each other
- With the help of Restful services, these web applications can reside on different environments, some could be on Windows, and others could be on Linux.
Restful Architecture
An application or architecture considered REST full or REST-style has the following characteristics
- State and functionality are divided into distributed resources – This means that every resource should be accessible via the normal HTTP commands of GET, POST, PUT, or DELETE. So if someone wanted to get a file from a server, they should be able to issue the GET request and get the file. If they want to put a file on the server, they should be able to either issue the POST or PUT request. And finally, if they wanted to delete a file from the server, they an issue the DELETE request.
- The architecture is client/server, stateless, layered, and supports caching –
- Client-server is the typical architecture where the server can be the web server hosting the application, and the client can be as simple as the web browser.
- Stateless means that the state of the application is not maintained in REST.For example, if you delete a resource from a server using the DELETE command, you cannot expect that delete information to be passed to the next request.In order to ensure that the resource is deleted, you would need to issue the GET request. The GET request would be used to first get all the resources on the server. After which one would need to see if the resource was actually deleted.
In REST architecture, a REST Server commonly gives access to resources and REST client accesses and changes the resources. Here each resource is determined by URIs/ global IDs. REST uses different representation to serve a resource like text, JSON, XML. JSON is the most famous one.
- REST Full Client-Server
- This is the most fundamental requirement of a REST based architecture.
- It means that the server will have a REST full web service which would provide the required functionality to the client.
- The client send's a request to the web service on the server. The server would either reject the request or comply and provide an adequate response to the client.
Comments
Post a Comment