views:

33

answers:

2

Is developping an EJB application is considered like a web services ?

Or the two are different ?

Or you can make EJBs like web services ?

A: 

An EJB is an object that has some useful methods, typically Business Logic, and those methods can be invoked by clients in a number of ways - one of those ways can be a Web Service interface.

In development terms it's pretty much just a matter of annotating the EJB with your chosen interfaces style.

Putting the logic in an EJB can be a good idea because you get easy control over Transactional behaviour, declarative Security and scalability from the EJB container.

djna
+2  A: 

My answer would be yes and no.

No in the sense that EJB is a programming model. This programming model contains concepts such as security, transaction demarcation, state management and persistency (stateful or stateless beans), and more. While web service is more a remoting technology, that is, a way to connect systems, which is SOAP in the case of web service. Under this perspective both are completely different topic (Web service could be compared to RMI-IIOP though).

Yes in the sense that both are usually referred as technologies to expose a service to the outside (as long as it's stateless). Under this perspective they belong to the same category. And an EJB can indeed be exposed very easily as a web service by annotating the bean accordingly.

Hope it brings some light to the distinction.

ewernli
I did understand your "yes", but not your "no". Can you tell me more the differences between "remoting technology" and "programming model". because to me, they seem the same.
mohamida
You design a solution so that it matches/leverages a programming model (examples: EJB, ASP.NET, Servlets, CORBA, maybe even MapReduce, etc.) A remoting technology is just a standard to exchange/marshal data (examples: SOAP, RMI, IIOP, JSON, etc.). The term web service is actually vague and can be seen as a bit of both.
ewernli