EJB Remote Invocations over REST: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 27: Line 27:
</pre>
</pre>


* The target service must be deployed in such a way that it bootstraps a JAX-RS service endpoint (WAR instead of
* The target service must be deployed in such a way that it bootstraps a JAX-RS service endpoint (WAR instead of EJB JAR)
  EJB JAR)

Revision as of 13:22, 2 May 2017

Internal

Overview

EJB calls can routed over REST invocations by changing "@EJB(lookup = "")" into "@Inject" and adding a RestClientProducer as shown in the example linked below.

GitHub Example

https://github.com/NovaOrdis/playground/tree/master/jee/ejb/ejb-over-rest

Changes from EJB to REST

  • The business interfaces of the target services must be annotated with JAX-RS annotations (business method(s) and
 association to a @Path). Note that the EJB @Remote annotation may remain on the business interface.
 
@Remote
@Path("/")
public interface Callee {

    @POST
    @Consumes("application/json")
    String businessMethodA(String arg);
}
  • The target service must be deployed in such a way that it bootstraps a JAX-RS service endpoint (WAR instead of EJB JAR)