I'm searching to understand the machinery needed to expose SLSB as RESTFul webservices. If I define and implement a simple EJB inside a Web Application project I just need to:
a) define Local interface and EJB implementation like in the following code:
b) define an extension of javax.rs.core.Application like the following code:
and the whole thing works: when the appserver starts (in this case, it's WebSphere, but I think that's irrelevant), the RESTFul service is exposed, and in RAD I can see a Services/REST entry in my project.
Anyway, I'd like to read your suggestions about exposing as REST services EJBs which are defined inside an EJB 3.1 project: how should I proceed ?
Of course I may define a WrapperBean, inject in it all EJBs whose method I want expose as service, but I'd like to know If there's another solution to this problem.
I'm afraid I've written a bunch of nonsense in this post.
Searching more on the web, I found out that it's simply not possible to expose as RESTFul webservices EJBs that are deployed as EJB Project, i.e, arent'part of a WAR project.
That sound reasonable, because EJB in EJB projects are not meant to be accessed via HTTP; indeed, if you try and expose them as JAX-WS webservices, RAD creates a Dynamic
web project as requests router.
So, I think that I'll try and follow a BusinessDelegate pattern implementation, for example like this :
Hope this may help someone else looking for solving similar problems, other suggestions are wellcome (of course !)
By the way: I have again to understand how multithreading invocations are handled....
Can't the EJBs are declared in EJB project, package as jar, kept in WEB-INF/lib folder as jar file and access them via HTTP as REST ? This way EJBS can also be accessible via other clients and more reusable. No ?
Regards, Sujeeth Pakala
SCJP, SCWCD, SCBCD, ICAD, XML Master Basic, Certified SOA Professional