File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes using EJB in web services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "using EJB in web services" Watch "using EJB in web services" New topic

using EJB in web services

Lila Houmani

Joined: Apr 15, 2004
Posts: 3

what is the advantages to use EJB to implement an application that would be exposed as a web services, if there is any ? why not using a javabeans only ? there is some case when javabean will not be sufficient ?

Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
You can use Java Beans in web services, provided that you can write your own security model, transaction manager, resource manager, Persistance Manager .....

All these services will be provided by Application Server (such as WebLogic) if you are using EJBs in web services.

Hope this helps,

Sreenivasa Majji
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
and some parts of the application server provided EJBs like Entity beans can be a big pain.

You can also look into Spring, Hibernate to achieve your web-service goals in simpler ways.

SCJP, blog
Pradeep Ram

Joined: Sep 29, 2004
Posts: 18
My 2 cents .. One of the primary reasons to use EJBs in webservices is, if you have a service available that is implemented using EJBs (say like a StockQuoteBean), if you need to expose this EJB to outside customers, you can expose the Bean as a WebService.

If you are planning for transactions using webservices like a OrderManagement system or TicketReservation, then you need the container benefits like Transaction/Security, then EJBs are a natural choice.

Or if you prefer the lighter frameworks, Spring will do the job for you.
subject: using EJB in web services
It's not a secret anymore!