Why is the REST web service always stateless


REST and SOAP are two different approaches to online data transfer. Both define how to create APIs that can be used to transfer data between web applications. REST (Representational State Transfer) comprises a number of software architecture principles. SOAP (Simple Object Access Protocol) is an official protocol administered by the World Wide Web Consortium (W3C). The main difference is that SOAP is a protocol and REST is not. Typically, an API uses either REST or SOAP, depending on the use case and the preferences of the developer.

Download the API User Guide

REST: Representational State Transfer

REST comprises a number of software architecture principles that are tailored to the requirements of lean web services and mobile applications. Since these are guidelines or recommendations, implementation is ultimately up to the developers.

When a data request is sent to a REST API, it is usually done using HTTP (Hypertext Transfer Protocol). APIs developed for REST (RESTful APIs or RESTful web services) can output messages in different formats depending on the requirements: HTML, XML, plain text or JSON. JSON (JavaScript Object Notation) is the preferred message format because it can (despite the name) be read by any programming language, is readable for humans and machines and is compact. Therefore, RESTful APIs are more flexible and easier to set up.

An application is said to be RESTful if it conforms to the following six architecture guidelines. A RESTful application needs:

  1. A client-server architecture made up of clients, servers, and resources.
  2. Stateless client-server communication, i. H. no client content is stored on the server between requests. Instead, information on the session status is stored on the client.
  3. Cachable data to eliminate the need for some client / server interactions.
  4. A uniform interface between components to transfer information in a standardized rather than application-specific form. Roy Fielding, the creator of REST, describes this as "the central feature that distinguishes the REST architectural style from other network-based styles".
  5. A multilayer system in which client / server interactions are extended to hierarchical layers.
  6. Code-on-demand, which allows servers to extend the functionality of a client by transmitting executable code. (This reduces visibility, so this policy is optional.)

SOAP: Simple Object Access Protocol

SOAP is a standard protocol that was initially developed to allow applications written in different languages ​​and on different platforms to communicate with one another. Because it is a protocol, it has built-in rules that add complexity and overhead, which can result in longer page load times. However, these standards offer built-in compliance that makes it attractive for corporate scenarios. The built-in compliance standards include security, atomicity, consistency, isolation, and persistence (ACID), a set of characteristics used to ensure reliable database transactions.

Common web service specifications include:

  • WS-Security (Web Services Security): Standardizes how messages are secured and transmitted using unique identifiers, so-called tokens.
  • WS-ReliableMessaging: Standardizes error handling between messages transmitted over an unreliable IT infrastructure.
  • WS-Addressing (Web Services Addressing): Packages routing information as metadata in SOAP headers instead of managing this information deeper in the network.
  • WSDL (Web Services Description Language): Describes what a web service does and where this service starts and ends.

When a request for data is sent to a SOAP API, it can be processed using one of the application-layer protocols: HTTP (for web browsers), SMTP (for email), TCP, and others. However, once a request is received, SOAP messages must be returned as XML documents - a markup language that is human and machine readable. A completed request to a SOAP API cannot be cached in a browser. As a result, the request cannot be accessed later without resending it to the API.


Many legacy systems may still be using SOAP. REST was introduced later and is often considered to be the faster alternative in web-based scenarios. REST is a set of guidelines for flexible implementation. SOAP is a protocol with specific requirements like XML messaging.

REST APIs are lean and therefore ideal for modern applications such as the Internet of Things (IoT), mobile applications and serverless computing. SOAP web services offer built-in security and transaction compliance that meet many business needs, but they are more complex to create. In addition, many publicly available APIs, such as the Google Maps API, also follow the REST guidelines.

Why Red Hat?

With Red Hat you get modular, lean and comprehensive open source API solutions with open standards that are available locally or in the cloud. These solutions ensure that you can make your IT more flexible and realize values ​​faster.