Enterprise JavaBeans hosted by WebSphere Application Server can act as
clients of CORBA servers, including servers running on third-party ORBs. These
EJB clients follow the same design model as any other enterprise beans. In
general, a minimal enterprise bean consists the following developer-provided
code:
- A home interface, which provides bean-creation methods
- A remote interface, which defines the business methods available to the
clients of the bean
- The bean class, in which the methods required by the Enterprise JavaBeans
specification are implemented, including implementations of the methods required
by the home and remote interfaces.
During deployment, additional code is generated for the container in
which the bean resides. This code is specific to the container, for example,
WebSphere Application Server, and is completely independent of any calls the
bean makes to non-WebSphere-based servers.
When the enterprise bean acts as a client to a server, the code supporting
that exchange resides in the implementation of the business methods of the
bean. This includes the code for getting a reference to the client-side WebSphere
ORB, contacting the server or desired servant object, and calling the methods
in the CORBA IDL interface between the enterprise bean and the CORBA server.
Typically, the least straightforward part of using a CORBA server on a
third-party ORB from an enterprise bean in the WebSphere environment is establishing
the connectivity between the enterprise bean and the server. After connectivity
has been established, making remote invocations is simply a matter of calling
the methods in the CORBA IDL interface.
The technique used to establish connectivity between the enterprise bean
and the server depends on the design of the application and the techniques
supported in common between the two ORBs. Common techniques include the following:
- Having the enterprise bean contact the name service used by the remote
ORB and look up the desired servant object.
- Using a client-side property to hold an initial object reference (IOR)
to the name service of the remote ORB. The client reads the property and uses
the IOR to contact the name service, from which it can look up the desired
servant object.
- Having the server write a file that contains the name-service IOR. The
client reads the file and uses the IOR to contact the name service, from which
it can look up the desired servant object.
- Having the server write a file that contains the IOR to the servant objects.
The client reads the file for the desired object and uses the IOR to contact
the object directly.