Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Locating CORBA objects using Java IDL

Learn how to use stringification and the COS Naming Service to find CORBA objects spread around the enterprise

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
One of the longest weeks in my programming career was the one I spent attempting to combine a CORBA object implemented using Visigenic's VisiBroker for Java with a client using JDK 1.2 beta 2.

Obviously, this was a while ago since Java 2 was released very recently and Visigenic subsequently has been swallowed by Borland, which morphed into Inprise. Anyway, ever the one who likes to stick to standard protocols and APIs, I originally implemented the server and client applications using the Java IDL API integrated into the JDK. Playing safe, the server and client relied on the standard CORBA naming service for locating the CORBA object. All went according to schedule until the server's default Java IDL ORB was replaced with Visigenic's ORB. If I used the VisiBroker Naming Service implementation, the client could not locate the naming service, and if I used the Java IDL implementation, the server could not locate the naming service. Pow-- instant headache!

Had I finally been let down by open standards? Had IIOP really not made it possible for multiple ORBs to interoperate? Yes and No turned out to be the respective answers to those questions. As usual, the Templar Knight in me ran off to do battle without first stopping to read the specification's fine print or performing adequate prototyping. A little food, sleep and research quickly solved the problem once all possible hacking (and I, myself) was exhausted.

I hope this article will prevent you from experiencing one of those dreaded weeks in which your progress report simply says: "Fixed a bug by writing three lines of code."

Interoperable Object Reference (IOR)

The CORBA market provides many strategies, standards, and products for locating CORBA objects, but only one mechanism works for all IIOP-compliant CORBA implementations: Interoperable Object References (IORs). When working in a multiple-ORB environment, an IOR usually provides the only means to obtain an initial reference to an object, be it a naming service, transaction service, or customized CORBA servant.

ORBs supporting IIOP identify and publish object references using IORs. An IOR contains the information required for a client ORB to connect to a CORBA object or servant. Specifically, an IOR contains the following:

IIOP version -- Describes the IIOP version implemented by the ORB

Host -- Identifies the TCP/IP address of the ORB's host machine

Port -- Specifies the TCP/IP port number where the ORB is listening for client requests

Key -- Value uniquely identifies the servant to the ORB exporting the servant

Components -- A sequence that contains additional information applicable to object method invocations, such as supported ORB services and proprietary protocol support



In short, an IOR specifies the wire protocol for talking to an object as well as specifying the object's network location.

The IOR structure isn't important to programmers, since an IOR is represented through a String instance by a process known as stringification. Stringification is the process of converting a servant reference to and/or from a string representation of an IOR. Once an object reference has been stringified, it can be used by other applications to obtain a remote servant reference.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Download the complete source in zip format. You will need Java 2 to run the code http://www.javaworld.com/jw-02-1999/enterprise/jw-02-enterprise.zip
  • Sun's Java IDL documentation, which includes documentation covering the Java IDL API, the naming service, creating and using CORBA object references, and an introductory tutorial http://java.sun.com/products/jdk/1.2/docs/guide/idl/index.html
  • Java 2 includes support for running CORBA server and client processes, including an implementation of a CORBA-compliant transient naming service http://java.sun.com/products/jdk/1.2/
  • Java 2 does not ship with an IDL-to-Java compiler so you must download it separately if you intend to develop and implement ORB-based services. Accessing this page requires you possess a Developer Connection account (joining is free) http://developer.java.sun.com/developer/earlyAccess/jdk12/idltojava.html
  • An excellent introductory tutorial to Java IDL is provided online in Sun's The Java Tutorial http://java.sun.com/docs/books/tutorial/idl/index.html
  • The Java Naming and Directory Interface (JNDI) is a standard Java extension and provides applications with a unified interface to multiple naming and directory services http://java.sun.com/products/jndi/index.html
  • The CORBA/IIOP 2.2 Specification is available online http://www.omg.org/corba/corbaiiop.html
  • The Iona OrbixNames, Iona's implementation of the COS Naming Service is documented online http://www.iona.com/products/sysman/orbixnames/fordevelopers.html
  • The VisiBroker Naming and Event Services, Inprise's implementation of the COS Naming Service, is documented online http://www.inprise.com/techpubs/books/vbnes/vbnes33/index.html
  • Read the first-ever Enterprise Java column,"Revolutionary RMIDynamic class loading and behavior objects," in the December issue of JavaWorld http://www.javaworld.com/jw-12-1998/jw-12-enterprise.html