For z/OS platforms

Using the Liberty Invoke API to call an enterprise bean from an external address space

Use the WebSphere optimized local adapter (WOLA) Invoke API to call from an external address space to a stateless session bean that is deployed on a local Liberty server for z/OS®.

Before you begin

To identify your enterprise bean as a potential target of an optimized local adapter call, your Enterprise JavaBean (EJB) application must implement the com.ibm.websphere.ola.ExecuteLocalBusiness interface as a local business interface. The interface is located in the wlp/dev/api/ibm/com.ibm.websphere.appserver.api.zosLocalAdapters_1.0.0.jar file.

The Liberty server must be active on the same z/OS image that the register request originates from. Ensure that the current address space is already registered and bound to the target optimized local adapter group using the Register API. For more information about registering an external address space, see Registering an external address space with a local Liberty server using optimized local adapters.

About this task

This method of calling an enterprise bean provides a simplified path for when you know the response area length before you call the bean. If you do not know the response area length or want more flexibility when you call the bean, see Using the Liberty optimized local adapters APIs to invoke an enterprise bean from an external address space.

Procedure

  1. Decide which parameters to use when you call the bean using the Invoke API, which is BBOA1INV.
    The API accepts parameters for the following items:
    • The register name that you specified when you called the Register API
    • The request type, which must be set to 1 for local EJB work requests
    • The name of the service to invoke, which must be the Java™ Naming and Directory Interface (JNDI) local business interface path name of the stateless session bean
    • The length of the service name
    • A pointer to the address of the start of the request data to send
    • The length of the request data to send
    • A pointer to the address of the start of the response data area
    • The length of the response data to send
    • The number of seconds until the connection times out

    For more information about API parameters, see Optimized local adapters APIs on Liberty for z/OS.

  2. Call the Invoke API for your caller with your selected parameters from a native-language application in the client address space. In the target Enterprise JavaBeans (EJB) application, the execute method runs and then starts any business logic that is required before returning the response data as a serialized byte array back to the native-language caller.
  3. Review the response data. A 0 return code and reason code indicates that the client Invoke API call completed successfully and the response data and response data length are saved in the areas designated by the caller.
  4. The client application repeats these steps using the same register name call, calling as many stateless session beans as needed, as often as needed.
    Attention: With the Invoke API, the three primitive functions, Send_Request, Receive_RespLen, and Get_Data are all completed. The calling thread is blocked until the response data is received and copied to the response area.

Results

The client starts a stateless session bean from the Liberty server using the optimized local adapter Invoke API.

Icon that indicates the type of topic Task topic

File name: twlp_dat_connectejbinvokeapi.html