Table 5‑1 outlines the process for developing Oracle Tuxedo CORBA applications that use the CORBA Name Service.
Table 5‑1 Development Process Before performing the steps in this topic, you need to start the server process for the CORBA Name Service. For more information, see “Starting the Server Process for the CORBA Name Service” on page 3‑2.After performing the development steps in this topic, use the buildobjclient and buildobjserver commands to compile server and client applications that use the CORBA Name Service. For more information about the buildobjclient and buildobjserver commands, see the Oracle Tuxedo Command Reference.An Oracle Tuxedo CORBA application accesses the CORBA Name Service using the interfaces defined in CosNaming.idl. This Object Management Group (OMG) Interface Definition Language (IDL) file defines the interfaces, COSnaming data structures, and exceptions used by the CORBA Name Service. The CosNaming.idl file is located in the following directory locations:drive:\%TUXDIR%\include\CosNaming.idlListing 5‑1 shows the OMG IDL for CosNaming.idl. The same OMG IDL file is used by both CORBA C++ applications.Listing 5‑1 CosNaming.idlThe include files for an Oracle Tuxedo CORBA C++ client application are located in the $TUXDIR/include directory on UNIX systems and the %TUXDIR%\include directory on Windows systems.The Bootstrap object supports a NameService environmental object for connecting to the root of the namespace. When using the NameService environmental object, the Object Request Broker (ORB) locates the root of the namespace. The object reference can then be narrowed to CosNaming::NamingContext or CosNamingContextExt. You need to connect to the Oracle Tuxedo namespace before binding objects into the namespace and resolving names in the namespace.Use the Bootstrap object or the CORBA Interoperable Naming Service (INS) bootstrapping mechanism to get an initial reference to the NameService environmental object. Use the Oracle proprietary mechanism if you are using the Oracle client ORB. Use the CORBA INS mechanism if you are using a client ORB from another vendor. For more information about bootstrapping the Oracle Tuxedo domain see Chapter 4, “CORBA Bootstrapping Programming Reference,” in the CORBA Programming Reference in the Oracle Tuxedo online documentation.Listing 5‑2 illustrates C++ code that establishes communication with an Oracle Tuxedo namespace.Listing 5‑2 C++ Example of Connecting to a NamespaceA stringified object reference for the root of the namespace can also be used to connect to a namespace in an Oracle Tuxedo domain. In order to use a stringified object reference, the -f command-line option must be specified when starting the server process for the CORBA Name Service. The -f command-line option writes the stringified object reference to the CNS_ROOT_FILE environment variable or to one of the following locations:Listing 5‑3 includes C++ code that establishes communication with an Oracle Tuxedo namespace using a stringified object reference.
2. If more than one IIOP Listener/Handler is defined in the UBBCONFIG file, the Oracle Tuxedo CORBA application must use the first IIOP Listener/Handler defined in the UBBCONFIG file by the TOBJADDR environment variable.The CORBA Name Service creates the stringified object reference for the root of the namespace, using the default IIOP Listener/Handler’s host and port. The first IIOP Listener/Handler defined in a UBBCONFIG file is considered the default IIOPListener/Handler. Using the default IIOP Listener/Handler causes all object references retrieved by the CORBA Name Service to be official connections. Transactions and security require the use of official connections.
• The cnsbind command
• The cnsbind command can be used to bind application objects or naming context objects to the Oracle Tuxedo namespace. The server process for the CORBA Name Service must be started before using the cnsbind command. For a complete description of the cnsbind command, see Chapter 2, “CORBA Name Service Reference.”Listing 5‑4 show the C++ code implementations of the bind() method of the CosNaming::NamingContext object. The code examples accept two parameters, representing the id and kind fields for a Name. These parameters initialize a Name for the SimpleFactory object and bind the SimpleFactory object to the namespace.Use the resolve() method of the CosNaming::NamingContext object to locate an object in a namespace in an Oracle Tuxedo domain. Listing 5‑5 shows the C++ code that accepts two parameters, representing the id and kind fields for a Name. The code example then binds to a naming context, resolves the name, and obtains an object reference for the specified object.