• The idl command, which compiles the OMG IDL file and generates the client stubs required for the CORBA interface.
• The buildobjclient command, which constructs a CORBA C++ client application executable.Generally, the OMG IDL files for the available interfaces and operations are provided to the client programmer by the application designer. This section contains the OMG IDL for the Basic sample application. Listing 2‑1 shows the univb.idl file, which defines the following interfaces:
Listing 2‑1 OMG IDL File for the Basic Sample ApplicationThe remainder of this topic assumes that you chose to use static invocation in your CORBA client application. If you chose to use dynamic invocation, see Using the Dynamic Invocation Interface.When creating CORBA C++ client applications, use the idl command to compile the OMG IDL file and generate the files required for the interface. The following is the syntax of the idl command:idl idlfilename(s)The IDL compiler generates a client stub (idlfilename_c.cpp) and a header file (idlfilename_c.h) that describe everything you need to have to use the client stub from the C++ programming language. You need to link these files into your CORBA client application.In addition, the IDL compiler generates skeletons that contain the signatures of the CORBA object’s operations. The generated skeleton information is placed in the idlfilename_s.cpp and idlfilename_s.h files. During development of the CORBA client application, it can be useful to look at the server header files and skeleton file.
• If you are using JDK version 1.2, you can use the idltojava command to compile the OMG IDL file. For more information about the idltojava command, see the documentation for the JDK version 1.2.The idltojava command or the IDL compiler generates the following:
•
• The CORBA helper class (interfaceHelper.java) and the CORBA holder class (interfaceHolder.java) that describe everything you need to use the client stub from the Java programming language.Note that each OMG IDL defined exception defines an exception class and its helper and holder classes. The compiled .class files must be in the CLASSPATH of your CORBA client application.In addition, the idltojava command or the IDL compiler generates skeletons that contain the signatures of the operations of the CORBA object. The generated skeleton information is placed in the _interfaceImplBase file.The following sections use portions of the client applications in the Basic sample application to illustrate the steps. For information about the Basic sample application, see the Guide to the CORBA University Sample Applications. The Basic sample application is located in the following directory on the Oracle Tuxedo software kit:drive:\tuxdir\samples\corba\university\basicTypically, no ORBid is specified and the default ORBid specified during installation is used. However, when a CORBA client application is running on a machine that also has CORBA server applications running and the CORBA client application wants to access server applications in another Oracle Tuxedo domain, you need to override the default ORBid. This can be done by hard coding the ORBid as BEA_IIOP or by passing the ORBid in the command line as _ORBid BEA_IIOP.The CORBA client application creates a Bootstrap object. A list of IIOP Listener/Handlers can be supplied either as a parameter, via the TOBJADDR Java property or applet property. A single IIOP Listener/Handler is specified as follows:When the IIOP Listerner/Handler is provided via TOBJADDR, the second argument of the constructor can be null.The host and port combination for the IIOP Listener/Handler is defined in the UBBCONFIG file. The host and port combination that is specified for the Bootstrap object must exactly match the ISL parameter in the Oracle Tuxedo domain’s UBBCONFIG file. The format of the host and port combination, as well as the capitalization, must match. If the addresses do not match, the call to the Bootstrap object will fail and the following message appears in the log file:For example, if the network address is specified as //TRIXIE::3500 in the ISL parameter in the UBBCONFIG file, specifying either //192.12.4.6.:3500 or //trixie:3500 in the Bootstrap object will cause the connection attempt to fail.On UNIX systems, use the uname -n command on the host system to determine the capitalization used. On Window 2000, use the Network Control Panel to determine the capitalization.Tobj_Bootstrap* bootstrap = new Tobj_Bootstrap(orb, “//host:port”);where this is the name of the Java appletAn Oracle Tuxedo domain can have multiple IIOP Listener/Handlers. If you are accessing an Oracle Tuxedo domain with multiple IIOP Listener/Handlers, you supply a list of Host:Port combinations to the Bootstrap object. If the second parameter of the Bootstrap command is an empty string, the Bootstrap object walks through the list until it connects to an Oracle Tuxedo domain. The list of IIOP Listener/Handlers can also be specified in TOBJADDR.
Note: Third-party client ORBs can also use the CORBA Interoperable Naming Service (INS) mechanism to gain access to an Oracle Tuxedo domain and its services. CORBA INS allows third-party client ORBs to use their ORB’s resolve_initial_references() function to access CORBA services provided by the Oracle Tuxedo domain and use stubs generated from standard OMG IDL to act on the instances returned from the domain. For more information about using the Interoperable Naming Service, see the CORBA Programming Reference.The CORBA client application must obtain initial references to the environmental objects that provide services for the CORBA application. The Bootstrap object’s resolve_initial_references operation can be called to obtain references to the FactoryFinder, InterfaceRepository, SecurityCurrent, TransactionCurrent, NotificationService, Tobj_SimpleEventsService, and NameService environmental objects. The argument passed to the operation is a string containing the name of the desired object reference. You need to get initial references only for the environmental objects you plan to use in your CORBA client application.CORBA client applications get object references to CORBA objects from factories. A factory is any CORBA object that returns an object reference to another CORBA object and registers itself as a factory. The CORBA client application invokes an operation on a factory to obtain an object reference to a CORBA object of a specific type. To use factories, the CORBA client application must be able to locate the factory it needs. The FactoryFinder object serves this purpose. For information about the function of the FactoryFinder object, see CORBA Client Application Development Concepts.Returns one factory whose ID field in the factory’s CORBA name component matches the input argument.The following C++ and Java examples show how to use the FactoryFinder find_one_factory_by_id method to get a factory for the Registrar object used in the CORBA client application for the Basic sample applications:The following C++ and Java examples illustrate getting the factory for the Registrar object and then invoking the get_courses_details() method on the Registrar object:When creating CORBA C++ client applications, use the buildobjclient command to construct a CORBA client application executable. The command combines the client stubs for interfaces that use static invocation, and the associated header files with the standard Oracle Tuxedo libraries to form a client executable. For the syntax of the buildobjclient command, see the Oracle Tuxedo Command Reference.To act as a CORBA client application, the CORBA server application must obtain a Bootstrap object for the current Oracle Tuxedo domain. The Bootstrap object for the CORBA server application is already available via TP::Bootstrap (for CORBA C++ client applications). The CORBA server application then uses the FactoryFinder object to locate a factory for the CORBA object that can satisfy the request from the CORBA client application.If the Java Plug-In is not installed, you need to download and install the JDK1.2 plug-in (jre12-win32.exe) and the HTML converter tool (htmlconv12.zip). You can obtain both these products from java.sun.com/products/plugin.You also need to read the Java Plug-In HTML Specification located at java.sun.com/products/plugin/1.2/docs. This specification explains the changes Web page authors need to make to their existing HTML code to have existing JDK 1.2 applets run using the Java Plug-In rather that the brower’s default Java run-time environment.To automatically launch the Java Plug-In when Internet Explorer or Netscape Navigator browses the HTML page for your applet, use the OBJECT tag and the EMBED tag in the HTML specification. If you use the HTML Converter tool to convert your applet to HTML, these tags are automatically inserted. For more information about using the OBJECT and EMBED tags, see java.sun.com/products/plugin/1.2/docs/tags.html.