Tuesday, January 27, 2009

Calling Stand alone reference from an EJB

It is as simple as mentioned, calling stand alone reference from an EJB. Create an EJB project let us use stateless session bean here as an example. In the EJB bean add the method which you want to call and use the piece of below code.

ServiceManager serviceManager = new ServiceManager();
(interface) service= (interface)serviceManager.locateService("");

After the lookup, with the help of service call the interface
and the operation with the parameters

service.operationname(parameters);

Add the newly created EJB project to your BEPL/Mediation Module App or project.
While creating the EJB project itself you will see option for
specifying App project,At the place use the ModuleApp Project Name.

For testing the EJB, use universalTestClient http://localhost:9080/UTC/

0 comments: