![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The following sections provide information on how to use the CORBA API:
The RMI-IIOP runtime is extended to support all CORBA object types (as opposed to RMI valuetypes) and CORBA stubs. Enhancements include:
CORBA Object Type support has the following limitations:
ORB.connect()
result in a second object hosted inside the server. It is important that you use ORB.disconnect()
to remove the object when it is no longer needed.
Follow these steps to implement a typical development model for customers wanting to use the CORBA API for outbound calls.
This section provides examples of several mechanisms to access the WebLogic ORB. Each mechanism achieves the same effect and their constituent components can be mixed to some degree. The object returned by narrow()
will be a CORBA stub representing the external ORB service and can be invoked as a normal CORBA reference. In the following code examples it is assumed that the CORBA interface is called MySvc and the service is hosted at “where” in a foreign ORB's CosNaming service located at exthost:extport
:
The following code listing provides information on how to access the WebLogic ORB from JNDI.
.
.
.
ORB orb = (ORB)new InitialContext().lookup("java:comp/ORB");
NamingContext nc = NamingContextHelper.narrow(orb.string_to_object("corbaloc:iiop:exthost:extport/NameService"));
MySvc svc = MySvcHelper.narrow( nc.resolve(new NameComponent[] { new NameComponent("where", "")}));
.
.
.
The following code listing provides information on how to create a WebLogic ORB.
.
.
.
ORB orb = ORB.init();
MySvc svc = MySvcHelper.narrow(orb.string_to_object("corbaname:iiop:exthost:extport#where"));
.
.
.
The following code listing provides information on how to access the WebLogic ORB using JNDI.
.
.
.
MySvc svc = MySvcHelper.narrow(new InitialContext().lookup("corbaname:iiop:exthost:extport#where"));
.
.
.
The WebLogic ORB supports most client ORB functions, including DII (Dynamic Invocation Interface). To use this support, you must not instantiate a foreign ORB inside the server. This will not yield any of the integration benefits of using the WebLogic ORB.
WebLogic Server also provides basic support for inbound CORBA calls as an alternative to hosting an ORB inside the server. To do this, you use ORB.connect()
to publish a CORBA server inside WebLogic Server by writing an RMI-object that implements a CORBA interface. Given the MySVC examples above:
.
.
.
class MySvcImpl implements MvSvcOperations, Remote
{
public void do_something_remote() {}
public static main() {
MySvc svc = new MySvcTie(this);
InitialContext ic = new InitialContext();
((ORB)ic.lookup("java:comp/ORB")).connect(svc);
ic.bind("where", svc);
}
}
.
.
.
When registered as a startup class, the CORBA service will be available inside the WebLogic Server CosNaming service at the location "where".
![]() ![]() ![]() |