JSM & EJB Design alternatives and questions
hi,
i am not sure if i got this point correct or not, but when we have a session bean we are invoke its busniess logic from a client application and from a web application, is this true or does it have limitations?
if that's the case then why do we need a web service, i mean what did it add to the regular session beans? i am talking about the sayhello example in the Java EE tutorial.
another question is what is really the difference between JMS and EJB. both will be invoked remotly or locally to execute the busniess logic, one difference that i can see is that with the queue type: the consumer doesn't have to be running in order for it to recieve the messages and messages will stay untill they are consumed.
may be if you can give me a real example from real world on how JSM can help better than EJB.
[843 byte] By [
malrawia] at [2007-11-26 23:41:45]

# 1
> i am not sure if i got this point correct or not, but
> when we have a session bean we are invoke its
> busniess logic from a client application and from a
> web application, is this true or does it have
> limitations?
It is true, if I understand you correctly.
>
> if that's the case then why do we need a web service,
> i mean what did it add to the regular session beans?
A session bean is only one possible implementation of a Web Service.
>
> another question is what is really the difference
> between JMS and EJB.
? They are different J2EE components altogether.
EJB has components for sync processing, and others for async processing, since MDBs are a type of JMS clients, although you still need a JMS server outside of the EJB container.
# 2
thanks Karma, you are being so helpful.
>A session bean is only one possible implementation of a Web Service.
do you mean that we can implement the service using servlets for example?
if we are talking about a simple HR web application, where we want to calculate the salary at the end of the month, i think there are more than one way to do it:
- can use a timer bean similar to the timer example in the EE tutorial
- can use a servlet that would do the job
- can use JSM, send a request for salary calculation and wait for the consumer to do the process.
in a simple none complicated senario like the one i mentioned, what are the pros and cons. i trying to understand when one should use a technology, defenetly there is no bold rule but some reasoning would help a begginer.
# 3
>A session bean is only one possible implementation of a Web Service.
in the other example given in the tutorial (cart example)
http://java.sun.com/javaee/5/docs/tutorial/doc/
the cart wasn't a web service.
so the question is what's the difference between a bean created as a web service, and a bean that's not. after all we can run methods of the bean (none web service) using web client
# 4
> >A session bean is only one possible implementation
> of a Web Service.
>
> so the question is what's the difference between a
> bean created as a web service, and a bean that's not.
> after all we can run methods of the bean (none web
> service) using web client
A Web service is an interface that clients call. A session bean is a particular way to implement that service.
A session bean that is implementing a Web service could be replaced by a simple POJO, without touching the client code, i.e the code calling the service. It's called decoupling.
# 5
thanks karma... i appreciate ur patince and help.so comparing between servlets and beans is a huge mistake.may you point me to other ways of implementing web services... i am trying to create a mental map of java technologies becuz i feel like i am lost in the ocian :)
# 6
The remark of karma about making your requirements drive technology choice is important.
> may you point me to other ways of implementing web
> services... i am trying to create a mental map of
> java technologies becuz i feel like i am lost in the
> ocian :)
JEE is a large sea of possibilities, all with pro's and con's. The first thing you have to do is define your requirements. The next step is to list the possible technoligies and as a last step, choose the one which fits best. OK, you have to implement the solution as well ...
Sure this does not help a lot, but i am afraid this is the way to go.
# 7
u r right about that ... but my question was what other technologies that we can use for implementing web services, regardless of the pros and cons. thanks
# 8
> may you point me to other ways of implementing web
> services...
A couple of popular ones are :
- [url=http://www.javaworld.com/javaworld/jw-05-2006/jw-0501-xfire.html]XFire[/url]
- [url=http://www.onjava.com/pub/a/onjava/2005/07/27/axis2.html] Apache Axis 2[/url].
There are others.