0

I am trying to develop a standalone client for a remote enterprise bean that is deployed on an Oracle cloud that uses the WebLogic application container. The EJB method expects parameters of a specific interface called "Task". The EJB class looks something like this:

@Stateless
public class EJBClass implements RemoteEJB { 
 @Override
 public Object performTask(Task task){
    return task.doWork();
 }
}

The client application has customized implementations of the interface as follows:

class CustomTask implements Task{
  @Override
  public Object doWork(){/* perform customized work and return the result */}
}  

And then there is a client class that invokes the EJB passing an instance of the CustomTask, as follows:

class Client{
  public static void main(String[] args){
    Context ctx = getInitialContext();
    RemoteEJB ejb = (RemoteEJB) ctx.lookup(...);
    Object result = ejb.performTask(new CustomClass());
  }
}

I know that this is possible by providing the rmi codebase in Java RMI, but I cannot find any documentation on how to do this with EJBs. I am wondering if such a feature is available in EJBS (which is expected to be), and if yes, could someone please put me in the right direction as how to do this? I am searching on internet, but so far I haven't been able to find a proper tutorial or documentation. Any help is highly appreciated.

0 Answers0