Accessing the process choreographer EJB interface

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

  1. Add a reference to the BusinessProcess session bean in the application deployment descriptor.
    Add the reference to:
    • The application-client.xml file, for a Java 2 Platform Enterprise Edition (J2EE) client application
    • The web.xml file, for a Web application
    • The ejb-jar.xml file, for an Enterprise JavaBeans (EJB) application

    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.

  2. Package the generated stubs with your application.
    If your application runs on a different Java Virtual Machine (JVM) from the one where the BPEContainer application runs.
    1. Package the files contained in the WebSphere/AppServer/ProcessChoreographer/client/bpe137650.jar file with the enterprise archive (EAR) file of your application.
    2. Set the Classs-Path parameter in the manifest file of the application module to include the bpe137650.jar file.
      The application module can be a J2EE application, a Web application, or an EJB application.
  3. Make the home interface of the BusinessProcess session bean available to the application using Java Naming and Directory Interface (JNDI) lookup mechanisms.
    // 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);
    The home interface of the BusinessProcess session bean contains a create method for EJB objects. The method returns the remote interface of the session bean.
  4. Access the remote interface of the BusinessProcess session bean.
    BusinessProcess process = processHome.create();
  5. Call the business functions exposed by the BusinessProcessService interface, for example:
    process.initiate("MyProcessModel",input);
    Calls from applications are run as transactions. A transaction is established and ended in one of the following ways:
    • Automatically by WebSphere Application Server (the deployment descriptor specifies TX_REQUIRED).
    • Explicitly by the application. You can bundle application calls into one transaction:
      // 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();

Related concepts
Authorization for EJB renderings



Searchable topic ID:   t6accejb
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/wfapi/tasks/t6accejb.html

Library | Support | Terms of Use | Feedback