This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful Session Beans CAN be used as web services

 
Allexicus Kernikus
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As much as I know stateful session beans CAN be exposed as web services (just add the @WebService annotationand you are ready to go).

Why does the SCEA literature suggest otherwise?
 
Tirumal Reddy Moolamalla
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we can expose EJB3 Stateless Session Bean as WS otherwise we can simply expose POJO as WS. This depends on the requirements. If our requirements demands using of EJB's then exposing EJB3 Stateless Session Bean as WS is fine. otherwise we will be misusing EJB, where we can acheive it using simple POJO based WS.

correct me if i am wrong.
 
Rishi Shehrawat
Ranch Hand
Posts: 218
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically state is not required to be maintained across two web service calls, so it does not make sense to use stateful session bean.
 
P Das
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like stateless EJBs (and POJOs) only can be made into web services. However, sometimes, you might need to maintain conversational states between multiple calls to the web service by more than one client, when the "flyweight" that stateless EJBs are falls short. Are you faced with such dilemma?

The choice between POJOs and stateless EJBs may depend on cross-cutting concerns such as performance (pooling), security, etc. and how much leverage you might gain through the inbuilt plumbing of EJB servers.

However, if you need stateless EJBs and conversational state, together, you might consider designing a custom state machine.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, stateful session beans cannot be used in web services. [A stateful session bean cannot have a web service endpoint interface. This is because SOAP-based web services are inherently stateless in nature.]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic