aspose file tools*
The moose likes Web Services and the fly likes Web service develepment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web service develepment" Watch "Web service develepment" New topic
Author

Web service develepment

swarupa patil
Ranch Hand

Joined: Feb 22, 2006
Posts: 62
Hi,
I am new to web services development.
I am developing web services using EJB 3.0.
I am confused on web service development using
stateless session bean.

What is use of state less session bean when we
are developing web services?

What is advantages of stateless session bean on
web service development?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by swarupa patil:
What is use of state less session bean when we
are developing web services?

What is advantages of stateless session bean on
web service development?


Web services are supposed to be stateless (HTTP is a stateless protocol and applications with no state on the server scale better) so that is why you can only use an SLSB. When you turn an SLSB into a web service you lose two major features that are usually the reason for using EJBs in the first place: declarative transaction control and security.

You may be tempted to use an SLSB so that application servers behind the same firewall can use it instead of the web service interface - the SLSB communication is faster (requires less bandwidth and (de)serialization is faster than XML (un)marshalling); however in doing so you may lose some flexibility in what you could be doing with your web service interface.

It usually makes more sense to implement your service with POJOs and use them together with a web service interface to build a web service (and add WS-Security and WS-Atomic Transaction support if required). Then you can reuse the POJOs to implement the same service with an SLSB interface (using EJB security and transaction control if required). That way you have the best of both worlds.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Web service develepment