EJB Remote Invocations over REST: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 12: Line 12:


=Changes from EJB to 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.
 
<pre>
@Remote
@Path("/")
public interface Callee {
    @POST
    @Consumes("application/json")
    String businessMethodA(String arg);
}
</pre>
* The target service must be deployed in such a way that it bootstraps a JAX-RS service endpoint (WAR instead of
  EJB JAR)

Revision as of 22:19, 1 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)