cancel
Showing results for 
Search instead for 
Did you mean: 

Calling java method from Remote EJB interface in wbdynpro Java (NetWeaver 7.3)

0 Kudos

Hi,

I have an ejb with session bean and assosiated EAR  where all methods are written with remote interface, I need to call this methods from a webdynpro java application from remote interface ( without  creating the model  by refering the EAR as dependency)

Something like this. ---

InitialContext ctx = new InitialContext();

 

     String lookupString = "sap.com/Fact_EAR/Fact_EJBBean ";

    

Object obj = ctx.lookup(lookupString);                   

Fact_EJBHome ejbHome=(Fact_EJBHome)javax.rmi.PortableRemoteObject.narrow(obj, Fact_EJBHome.class);

   Fact_EJB ejbBean=ejbHome.create();

         

     int fact=ejbBean.Fact(5);

----

Once I get the ejbBean object from the  sample code above I can get the methods from the bean which I created.

Please help.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member191044
Active Contributor
0 Kudos

Is there a reason why you cannot reference the ear? Otherwise you could try to do that with reflections to call your methods (i have never tried that before). Where exactly are you stuck? Does the lookup even work and you don't know how to access the methods?

0 Kudos

I dont want to add the dependency of EAR in the webdynpro project and create the Model from EJB.

I want to use the remote interface and call the EJB methods from webdynpro application which is on the other server, like we call the adaptive webservice from EJB, in the same manner I want to call the remote interface and use the EJB methods in the webdynpro applicatioon.

I need  help on how and where to use the JNDI name and other steps in the EJB project and the respective steps  to call EJB methods in the Webdynpro application (Remote call).

Thanks

former_member191044
Active Contributor
0 Kudos

As I said i have never tried it myself but take a look at this:

Accessing Enterprise JavaBeans from Remote Clients - Developing Java EE 5 Applications - SAP Library

This should help to get the lookup working.