• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stateful Session Beans CAN be used as web services

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic