Is it possible to create an EJB with implementation in PHP, accessible through REST (not RMI)?
A:
EJB is programming model, where the EJB components are deployed and then managed by an application server which provides managed facilities to the EJB, like declarative transactions, dependency injection, security, etc. You can not code an EJB in PHP and deploy it in an app. server.
You can however code anything you want in PHP and expose that with REST, then access this REST resource from other EJB. But that doesn't make the REST resource code PHP be EJB.
ewernli
2010-07-23 10:38:26
But I can do it with RMI, right? I can have EJB Interface in Java on one application server, and EJB Implementation in PHP accessible through RMI on another server. Am I right?
Vincenzo
2010-07-23 11:51:25
@FaZend.com When you deploy an EJB, the app. server automatically exposes it as IIOP-RMI, that's one of the managed facilities. But you can not code an EJB the way around like you propose, which is to implement an RMI interface and make the app. server knows about it. I fear this is simply not possible.
ewernli
2010-07-23 12:35:47
@FaZend.com Well, actually, you could maybe. If your implementation fulfills the complete EJB specs, two heterogenous app. server are supposed to be able to cooperate. I've never seen that in practice, but in theory you can write an app. server in whatever language you want as long as it exposes the EJB correctly according to IIOP-RMI, and the spec.
ewernli
2010-07-23 12:40:27
Exactly. And my question is - whether it's possible to use REST instead of IIOP-RMI? Maybe I can teach my Java application server to do it?
Vincenzo
2010-07-23 13:34:34
@FaZend.com Not that I'm aware of. RMI-IIOP and CORBA interop are a hell of specification. They, among other things, mandate the support distributed transaction propagation between app. server which is out of reach with REST. Plus, these technologies are distributed object technologies, REST is a way to expose a service, not remote objects.
ewernli
2010-07-23 21:38:18