0
2.3kviews
RESTFUL WEB SERVICES
1 Answer
0
19views
  • REST stands for REpresentational State Transfer. REST is web standards based architecture and uses HTTP Protocol.
  • It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. REST was first introduced by Roy Fielding in 2000.
  • In REST architecture, a REST Server simply provides access to resources and REST client accesses and modifies the resources.
  • Here each resource is identified by URIs/ global IDs. REST uses various representation to represent a resource like text, JSON, XML. JSON is the most popular one.

1 HTTP methods

Following four HTTP methods are commonly used in REST based architecture.

GET − Provides a read only access to a resource.

POST − Used to create a new resource.

DELETE − Used to remove a resource.

PUT − Used to update a existing resource or create a new resource.

2 RESTFul web services

  • A web service is a collection of open protocols and standards used for exchanging data between applications or systems.
  • Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer.
  • This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards.
  • Web services based on REST Architecture are known as RESTful web services. These webservices uses HTTP methods to implement the concept of REST architecture.
  • A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation such as JSON and set of HTTP Methods.
Sr.No. URI HTTP Method POST body Result
1 /UserService/users GET empty Show list of all the users.
2 /UserService/addUser POST JSON String Add details of new user.
3 /UserService/getUser/:id GET empty Show details of a user.

3.12 Comparison of SOAP AND REST

SOAP REST
SOAP stands for Simple Object Access Protocol REST stands for Representational State Transfer
SOAP is a protocol. SOAP was designed with a specification. It includes a WSDL file which has the required information on what the web service does in addition to the location of the web service. REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being Client Server Stateless Cacheable Layered System Uniform Interface
SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern. REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern.
SOAP uses service interfaces to expose its functionality to client applications. In SOAP, the WSDL file provides the client with the necessary information which can be used to understand what services the web service can offer. REST use Uniform Service locators to access to the components on the hardware device. For example, if there is an object which represents the data of an employee hosted on a URL as https://demo.guru99 , the below are some of URI that can exist to access them https://demo.guru99.com/Employee https://demo.guru99.com/Employee/1
SOAP can only work with XML format. As seen from SOAP messages, all data passed is in XML format. REST permits different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is JSON.
Please log in to add an answer.