Why can not state horns be exposed as web services?

综合编程 2018-04-13 阅读原文

I have been reading about Stateful and Stateless session beans and came across a sentence that states that:

Stateful session beans cannot be exposed as web services.

Can anyone elaborate why ?

Every Stateful bean instance located in the EJB Container has an unique object identity.

From spec.: 3.4.7.1 Stateful Session Beans
A stateful session object has a unique identity that is assigned by the container at the time the object is created.

In order to use a Stateful bean, the client code needs to get a Stateful reference from the EJB Container. This reference has to be used to make every future request. Due to the reference object knows the identity associated to the stateful bean, you can be sure that all requests that participate in the "conversation" will be resolved for the same instance bean. This means that the Client has an important role in achieving the stateful behavior.

The SOAP protocol doesn't provide a way that allow to store in a web service client this identity, therefore, if the client doesn't know which stateful instance has the conversational state, every request will be processed by different ejb (such as the case of stateless).

Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!

您可能感兴趣的

Initialize the @EJB fields I am newbie in EJB. I have a class with following fields @Stateless @Transac...
Many web references using the same class I have a C# project which has many web references to a third party product. A...
The boot pot is not called I created a Java Web Application Project in NetBeans, and created a startup b...
Python开发【Tornado】:异步Web服务(二)... 真正的 Tornado 异步非阻塞 前言: 其中 Tornado 的定义是 Web 框架和异步网络库,其中他具备有异步非阻塞能力,能解决他两个框架请...
Spring Boot RESTful Web Service Example Spring Boot RESTful Web Service Example DZone's Guide to Spring Boot...