Meaningless Drivel is fun!*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes stateless session bean and web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "stateless session bean and web service" Watch "stateless session bean and web service" New topic
Author

stateless session bean and web service

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
I am confused in the relationship b/w web service and stateless session bean.

A stateless session bean can be a client of web service? Or A stateless session bean can be a web service? And other client can access it like web service?

Please put some more information about both.

Thanks.
eduardo ferreira
Greenhorn

Joined: Oct 01, 2007
Posts: 16
Originally posted by ankur rathi:
I am confused in the relationship b/w web service and stateless session bean.

A stateless session bean can be a client of web service? Or A stateless session bean can be a web service? And other client can access it like web service?

Please put some more information about both.

Thanks.


Yes, yes, and yes. But when you use web services instead of IIOP to access a SLSB you lose some infrastructure services like transaction propagation.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by eduardo ferreira:


Yes, yes, and yes. But when you use web services instead of IIOP to access a SLSB you lose some infrastructure services like transaction propagation.


Thanks Eduardo.

Can you explain little bit more about this line: "But when you use web services instead of IIOP to access a SLSB you lose some infrastructure services like transaction propagation."

I searched but didn't understand it.

Thanks.
Nagendra Inuguri
Ranch Hand

Joined: Jan 08, 2004
Posts: 76
In my opinion, SLSB can still run under a container transaction. But it cannot propagate client's transaction to the bean.


SCJP SCWCD SCDJWS SCBCD5 SCEA5
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Ankur,

you can transform a session bean into a web service, just annotate your session bean with the @WebService annotation.


SCJP, SCJD, SCWCD, SCBCD
eduardo ferreira
Greenhorn

Joined: Oct 01, 2007
Posts: 16
Originally posted by ankur rathi:

Can you explain little bit more about this line: "But when you use web services instead of IIOP to access a SLSB you lose some infrastructure services like transaction propagation."

I searched but didn't understand it.


When using container-managed transactions, you set attributes to define the transaction type of the method. When using any of the following:
# Required
# Mandatory
# Supports
If the caller has a transaction, it will be bound to the transaction used on this method (so if the caller's transaction rolls back the client transaction will roll back also). If the caller is remote, the only way for this to work is if the protocol being used is IIOP.

So, when using an EJB to expose a web service, you should think that it's methods should have only "requires new" or "not supported" transaction behavior.
Julio Viegas
Greenhorn

Joined: Jul 01, 2007
Posts: 11
Originally posted by Nagendra Inuguri:
In my opinion, SLSB can still run under a container transaction. But it cannot propagate client's transaction to the bean.


If BMT is applied, and the client is a JEE container(including the client container, from the four types of containers), yes it can!

In CMT scenario, only SLSB(as client) can do it.

Rgrds,
JV
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stateless session bean and web service