Search code examples
restsoapprotocolsstatelessstateful

Is SOAP a stateful protocol? Is REST really stateless? How can one store data using REST?


Is SOAP designed to be a stateful? How can it be reached? SOAP use RPC, so where to store data?

Is REST designed to be a stateless? Is it possible to store data in JSON ? Is it so wrong?

Thanks


Solution

  • Is REST designed to be a stateless?

    Yes, it really is -- but Fielding is precise about what stateless means in the context of REST:

    communication must be stateless in nature, as in the client-stateless-server (CSS) style of Section 3.4.3 (Figure 5-3), such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.

    In other words, to correctly interpret a request, the server does not need to remember any previous requests.

    For example, contrast HTTP (where credentials are part of the metadata of the request) with FTP (where credentials are sent separately from the RETR command).