Why and when to perform this task
An application accesses the BusinessProcess session bean through the home and remote interfaces of the bean.Steps for this task
Add the reference to the remote home interface as in the following example:
<ejb-ref> <ejb-ref-name>ejb/BusinessProcessHome</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.bpe.api.BusinessProcessHome</home> <remote>com.ibm.bpe.api.BusinessProcess</remote> </ejb-ref>
If you use WebSphere Studio to add the EJB reference to the deployment descriptor, the binding for the EJB reference is automatically created when the application is deployed. For more information on adding EJB references, refer to the WebSphere Studio documentation.
// Obtain the default initial JNDI context Context initialContext = new InitialContext(); // Lookup the remote home interface of the BusinessProcess bean Object result = initialContext.lookup("java:comp/env/ejb/BusinessProcessHome"); // Convert the lookup result to the proper type BusinessProcessHome processHome = (BusinessProcessHome)javax.rmi.PortableRemoteObject.narrow (result,BusinessProcessHome.class);
BusinessProcess process = processHome.create();
process.initiate("MyProcessModel",input);
// Obtain user transaction interface UserTransaction transaction= (UserTransaction)initialContext.lookup("jta/usertransaction"); // Begin a transaction transaction.begin(); // Applications calls ... // On successful return, commit the transaction transaction.commit();