| Author |
web services is replacement for EJB
|
jacob deiter
Ranch Hand
Joined: Apr 02, 2008
Posts: 576
|
|
|
Can I say web services is replacement for EJB?
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
|
|
|
NO
|
 |
Jair Rillo Junior
Ranch Hand
Joined: Aug 27, 2008
Posts: 114
|
|
No!! Both have different purpose, although you can use Webservice plus EJB3 in an easy way. I have been using WebService + EJB3 + JMS together in the same project successfully
|
Regards, Jair Rillo Junior
http://www.jairrillo.com/blog, SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 5.0, IBM SOA Associate (Test 664).
|
 |
jacob deiter
Ranch Hand
Joined: Apr 02, 2008
Posts: 576
|
|
Thanks for you reply,sorry for asking this again,I read a some article,in that given as "EJB is a server component deployed in different JVMs.So Instead of accessing the EJB thru RMI,EJB can be implemented as web services in remote machine and used in my application.So here No role of EJB." Please correct me if i am wrong
|
 |
Jair Rillo Junior
Ranch Hand
Joined: Aug 27, 2008
Posts: 114
|
|
Originally posted by jacob deiter: Thanks for you reply,sorry for asking this again,I read a some article,in that given as "EJB is a server component deployed in different JVMs.So Instead of accessing the EJB thru RMI,EJB can be implemented as web services in remote machine and used in my application.So here No role of EJB." Please correct me if i am wrong
That's true. If you have an EJB3 component and want to expose it as Webservice, only use an annotation @Webservice, it is really simple. However, when you access an EJB through Webservice you will loose performance, because Webservice uses HHTP/SOAP protocol and EJB itself uses RMI-IIOP (it's much faster than SOAP)
|
 |
Chintan Rajyaguru
Ranch Hand
Joined: Aug 19, 2001
Posts: 341
|
|
Jacob, Let's take a step back here. A service is a piece of functionality. The service must be implemened and EJB is a means to implement the service. This service can be consumed by 1. A java consumer using ejb client jar over RMI-IIOP 2. Any consumer using web service client over SOAP-HTTP If you expose something as a web service, it just means that the service can be invoked using SOAP/HTTP but the role of implementation doesn't go away. If you take the EJB out, who will execute the logic of the service? If you are thinking EJB allows a client in a remote JVM to invoke a service, similarly, web service allows a remote client to invoke a service so you don't need EJB, you are right (and wrong). You don't need EJB from remote access perspective. You can use a POJO (Plain Old Java Object) and expose it as a web service and access it remotely. However, if you don't use EJB, you loose container provided functionality such as role based security, transactions etc. Also, plain java call runs faster than EJB runs faster than web service. So, for performance reasons you may decide to stick with EJB as opposed to web services. Lately, alternative approaches like servlet based web service and spring container supported POJO based web service are becoming popular. They don't suffer from some of the disadvantages of EJBs. On the other end of the spectrum there are also concepts like REST-ful services, which can use JSON format making the web service perform even better (JSON is an alternative to XML. It reduces the overhead of XML processing). So, to summarize, EJB isn't needed from remote access perspective but they may be needed based on other requirements. Hope this helps...
|
ChintanRajyaguru.com
SOADevelopment.com - Coming soon!
|
 |
jacob deiter
Ranch Hand
Joined: Apr 02, 2008
Posts: 576
|
|
|
Thank you all!!!.
|
 |
 |
|
|
subject: web services is replacement for EJB
|
|
|