Intervendor EJB interoperability  Invoking EJB components from CORBA C++ clients

Chapter 9: EAServer EJB Interoperability

Invoking non-EJB components from EJB clients

To invoke a non-EJB component from an EJB client, you must first create a home interface for the component, then generate EJB stubs for the component’s interfaces. Then you can instantiate proxies for the non-EJB component using the standard EJB client design pattern.

Create a home interface

Non-EJB components can implement several remote interfaces. To instantiate proxies for any remote interface from EJB clients, you must use a corresponding home interface. Use EAServer Manager to create a home interface for each IDL interface that the component implements. The home interface must have a single create method that takes no parameters and returns the remote interface.

Even with a home interface defined, EAServer creates component instances using the standard method for the component’s lifecycle model. A non-EJB component does not need to implement any additional methods to support the home interface.

StepsCreating the home interface

  1. Expand the component’s icon, then highlight the Interfaces folder beneath the component. Choose File | Set Home Interface.

  2. In the Home Interface dialog box, enter the home interface name as:


    where module is the IDL module where the remote interface is defined, and component_interface is the base (non-nested) name of the remote interface. For example, MyPackage::MyComponentHome.

  3. Click Add New. EAServer creates the interface and an icon for the interface appears in the component’s Interfaces folder.

  4. Highlight the home interface icon, and choose File | New Method.

  5. Enter “create” as the method name and click Create New Method.

  6. Change the following in the Method Properties dialog, leaving other fields at their default settings:

  7. Click OK to close the Method Properties dialog box.

Generate EJB stubs

Use EAServer Manager to generate EJB stubs for the component, specifying a different package or code base for the EJB stubs than used by the existing CORBA stubs.

CORBA and EJB stubs share class names but do not share the same implementation. Therefore, each type must be in a different Java package or use a different code base.

“Generating EJB stubs” describes how to generate the stub files.

Instantiating the home interface

After defining a home interface and generating EJB stubs, you can instantiate a home interface for the component using the standard EJB technique, as described in Chapter 8, “Creating Enterprise JavaBeans Clients”.

The component’s home interface name matches the value of the property. For non-EJB components, you must view the value of this property using the Advanced tab in the Component Properties dialog box. If the property is not set, the default is initial-context/package/component, where initial-context is the server’s initial naming context, package is the EAServer Manager package where the component is installed, and component is the component name as displayed in EAServer Manager.

Calling methods in the remote interface

The methods in the Java remote interface follow the standard CORBA IDL-to-Java datatype mappings. To allow increased interoperability between EJB clients and non-EJB components, EAServer allows use of out and inout parameters in the remote interface. In the Java remote interface, these are represented by the same holder classes as used in CORBA stubs. See “Holder classes” for more information on using holder classes.

Invoking non-EJB components from EJB components

In EJB component code, you can make intercomponent calls using EJB stubs and the EJB client interface as described above. You can also use the CORBA client interface as described in “Issue intercomponent calls”.

Copyright © 2005. Sybase Inc. All rights reserved. Invoking EJB components from CORBA C++ clients