Putting It in the Public Eye

We still need to do some work to make the Java implementation of our IDL interface available to remote clients. We must instantiate one or more instances of our CORBA server implementation and connect them to an ORB on the server so that they can receive remote method requests. Then clients need to somehow obtain remote references to our server objects. A client obtains a remote reference in two fundamental ways: it can get an initial object reference (usually to a CORBA service of some kind, like a Naming Service) using the ORB.resolve_initial_references() method and somehow find a reference to the remote object through method calls on the initial object, or it can get a “stringified” reference to the remote object (either an Interoperable Object Reference (IOR) or an Interoperable Naming Service (INS) URL) and use the local ORB to convert it to a live object reference.

For the first case, a remote object needs to be registered in some way with a server-side ORB and probably with a CORBA service of some kind. Connecting your CORBA object to an ORB enables it to accept remote method requests from clients. Registering your object with a CORBA service makes it easier for remote clients to find your object in the first place.

In order for you to register a remote object, you first have to get a reference to an ORB. We’ll look at how to do this, then look at registering the remote object with a Naming Service (the most common way to “publish” remote objects ...

Get Java Enterprise in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.