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.
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.
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.]
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|