Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it imply to call a web service (SOAP over HTTP) stateless?

I had a concept that HTTP is stateless, so SOAP over HTTP (for web services) is also stateless. I used to think that state meant “state of the object”. For an example, suppose I have a class called Employee and methods called setSalary and getSalary. If a caller of the web service calls setSalary and makes the salary 1000, then if getSalary is called, the caller should not necessarily get the value 10000. When I tested getsalary and got 1000 (i.e., the value assigned by setSalary), I was wondering how the state of the Employee object was maintained.

The Stack Overflow question Webservices are stateless? mentions tricks like cookies used to maintain state, but since I did not made any explicit effort to maintain state, how was the state of the Employee object maintained?

Please let me know if I have misunderstood the concept of state/stateless altogether.

like image 450
Pritesh Avatar asked May 02 '12 06:05

Pritesh


People also ask

Are SOAP web services stateless?

SOAP is by default stateless, but it is possible to make this API stateful. It is stateful, i.e. no server-side sessions occur. It is data-driven, meaning that data is available as resources. It has WS-security (Enterprise-level security) with SSL support.

What is meant by HTTP being stateless?

The HTTP protocol is a stateless one. This means that every HTTP request the server receives is independent and does not relate to requests that came prior to it.

Why is HTTP called a stateless protocol Why is it so?

HTTP is a "stateless" protocol which means each time a client retrieves a Webpage, the client opens a separate connection to the Web server and the server automatically does not keep any record of previous client request.

Does soap use https?

SOAP may also be used over HTTPS (which is the same protocol as HTTP at the application level, but uses an encrypted transport protocol underneath) with either simple or mutual authentication; this is the advocated WS-I method to provide web service security as stated in the WS-I Basic Profile 1.1.


1 Answers

Stateless means the state of the service don't persist between subsequent requests and response. whereas, in stateful the state is persisted between subsequent requests i.e. each request need to know and retain changes made in previous requests.

Banking application is an example of stateful application,where user first login then make transaction and logs out. If user tries to make the transaction after logout, he will not be able to do so.

Yes, http protocol is essentially a stateless protocol but to make it stateful we make use of HTTP cookies. So, is SOAP by default. But it can be make stateful likewise, depends upon framework you are using.

The case you provided, Are you trying to set and get values in subsequent requests or in same requests? Then only, i can comment on that.

like image 168
shashankaholic Avatar answered Oct 15 '22 04:10

shashankaholic