When discussing EJBs and Web services, stateless EJBs are usually recommended for building Web services. This is for a couple of reasons:
1) At present, Web services built around published standards are stateless
2) Stateless EJBs are usually recommended by the EJB community for encapsulating business logic.
Since current standards for Web services do not address maintaining state, you must use your own mechanism for maintaining state, such as proprietary cookies.
SOAP is currently the most widely discussed technology for Web service implementation and transport. Thus, any technology used to implement the logic that a service will expose, must, for all practical purposes, support SOAP. This means that whether or not you use EJBs to implement your Web services, your service implementations must interact with SOAP.
The EJB 2.1 specification introduces a standard mechanism for exposing a stateless session bean as a Web service. EJBs written to an earlier specification can take advantage of JAX-RPC and JAXM to interact as a Web service. Note that plain-old-Java-objects (POJOs) can be exposed as Web services using JAX-RPC and JAXM, as well.
Further information pertaining to exposing EJBs as Web services can be found at:
Dig Deeper on Java Web Services
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.