Creating ActiveX Client Applications
This topic includes the following sections:
For a description of the concepts you need to understand before developing an ActiveX client application, see Concepts for ActiveX Client Applications.
Summary of the Development Process for ActiveX Client Applications
The steps for creating an ActiveX client application are as follows:
Load the Automation environmental objects into the Interface Repository.
Verify that the CORBA interfaces you want to access from your ActiveX client application are loaded in the Interface Repository. If necessary, load the Object Management Group (OMG) Interface Definition Language (IDL) definitions for the CORBA interfaces into the Interface Repository.
Start the server process for the Interface Repository.
Use the BEA Application Builder to create ActiveX bindings for the interfaces of the CORBA object.
Load the type library for the ActiveX binding in your development tool.
Write the ActiveX client application. This topic describes creating a basic client application.
Create a deployment package for the ActiveX client application.
Each step in the process is explained in detail in the following sections.
The BEA Tuxedo development environment for ActiveX client applications includes the following:
The BEA Application Builder
The BEA Application Builder is the development tool that creates ActiveX views of CORBA objects. The BEA Application Builder is the primary user interface to the BEA ActiveX Client. It can be used to select which CORBA objects are available to desktop applications, to create ActiveX views of the CORBA objects, and to create packages for deploying ActiveX views of CORBA objects to client machines.
To use an ActiveX view, you load the interfaces of the CORBA objects into the Interface Repository. You then create an ActiveX binding for the CORBA interface. The binding describes the interface of a CORBA object to ActiveX. The combination of the ActiveX client application and the generated binding creates the view of the object.
For a description of the BEA Application Builder and how it works, see the online help, which is integrated into the product graphical user interface (GUI).
Step 1: Loading the Automation Environmental Objects into the Interface Repository
Load the Automation environmental objects into the Interface Repository so that the interface definitions for the objects are available to ActiveX client applications. From the MS-DOS prompt, enter the following command to load the OMG IDL file (TOBJIN.idl) into the Interface Repository:
prompt> idl2ir -D _TOBJ -I drive:\tuxdir\include drive:\tuxdir\include\tobjin.idl
Step 2: Loading the CORBA Interfaces into the Interface Repository
Before you can create an ActiveX view for a CORBA object, the interfaces of the CORBA object need to be loaded into the Interface Repository. If the interfaces of a CORBA object are not loaded in the Interface Repository, they do not appear in the Services window of the BEA Application Builder. If a desired CORBA interface does not appear in the Services window, use the idl2ir command to load the OMG IDL that defines the CORBA into the Interface Repository. The syntax for the idl2ir command is as follows:
idl2ir [repositoryfile.idl] file.idl
Directs the command to load the OMG IDL files for the CORBA interface into the specified Interface Repository. Specify the name of the Interface Repository in the BEA Tuxedo domain that the ActiveX client application will access.
Specifies the OMG IDL file containing definitions for the CORBA interface.
For a complete description of the idl2ir command, refer to the BEA Tuxedo Command Reference.
Creating CORBA Client Applications provides a sample OMG IDL file that is the starting point for all the CORBA University sample applications. Based on this OMG IDL file, the following CORBA interfaces should appear in the BEA Application Builder window:
For a complete description of the University sample applications, see the Guide to the CORBA University Sample Applications.
Step 3: Starting the Interface Repository Server Application
ActiveX client applications read the interface definitions for CORBA objects from the Interface Repository dynamically at run time and translate them to Automation objects. Therefore, the server process for the Interface Repository needs to be started so that the interface definitions are available. Use the UBBCONFIG file to start the server process for the Interface Repository.
Note: In some cases, the system administrator may have performed this step.
In the UBBCONFIG file for the BEA Tuxedo domain, check that TMIFRSVR, the server application for the Interface Repository, is started. The following entry should appear in the UBBCONFIG file:
SRVGRP = SYS_GRP
SRVID = 6
RESTART = Y
MAXGEN = 5
GRACE = 3600
In addition, make sure that the ISL parameter to start the IIOP Listener/Handler is specified. The following entry should appear in the UBBCONFIG file:
SRVGRP = SYS_GRP
SRVID = 5
CLOPT = "-A -- -n //TRIXIE:2500"
where TRIXIE is the name of the host (server) system and 2500 is the port number.
For more information about starting server applications and specifying the ISL parameter, see Setting Up a BEA Tuxedo Application.
Step 4: Creating ActiveX Bindings for the CORBA Interfaces
For an ActiveX client application to access a CORBA object, you must generate ActiveX bindings for the interfaces of the CORBA object. You use the BEA Application Builder to create the ActiveX bindings for CORBA interfaces.
To create an ActiveX binding for a CORBA interface:
The Domain logon window appears.
The BEA Application Builder logon window appears.
The BEA Application Builder:
The type library file is named: DImodulename_interfacename.tlb
You can now use the ActiveX view from an ActiveX client application.
For a complete description of the features of the BEA Application Builder, see the online help that is integrated into the BEA Application Builder graphical user interface (GUI).
Step 5: Loading the Type Library for the ActiveX Bindings
Before you start writing your ActiveX client application, you need to load the type library that describes the ActiveX binding for the CORBA interface in your development tool. Follow your development product's instructions for loading type libraries.
For example, in Visual Basic, you use the References option on the Project menu to get a list of available type libraries. You then select the desired type libraries from the list.
By default, the BEA Application Builder places all generated type libraries in \tuxdir\TypeLibraries. The type library for the ActiveX binding of the CORBA interface has the following format:
Step 6: Writing the ActiveX Client Application
The ActiveX client application must do the following:
The following sections use portions of the ActiveX 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 BEA Tuxedo software kit:
Including Declarations for the Automation Environmental Objects, Factories, and ActiveX Views of CORBA Objects
To prevent errors at run time, you need to declare the object types of:
The following example is Visual Basic code that declares the Bootstrap and FactoryFinder objects, the factory for the ActiveX view of the Registrar object, and the ActiveX view of the Registrar object:
\\Declare Bootstrap object\\
Public objBootstrap As DITobj_Bootstrap
\\Declare FactoryFinder object\\
Public objFactoryFinder As DITobj_FactoryFinder
\\Declare factory object for Registrar Object\\
Public objRegistrarFactory As DIUniversityB_RegistrarFactory
\\Declare the ActiveX view of the Registrar object\\
Public objRegistrar As DIUniversityB_Registrar
Establishing Communication with the BEA Tuxedo Domain
When writing an ActiveX client application, there are two steps to establishing communication with the BEA Tuxedo domain:
The following Visual Basic example illustrates using the CreateObject operation to create a Bootstrap object:
Set objBootstrap = CreateObject("Tobj.Bootstrap")
You then initialize the Bootstrap object. When you initialize the Bootstrap object, you supply the host and port of the IIOP Listener/Handler of the desired BEA Tuxedo domain, as follows:
The host and port combination for the IIOP Listener/Handler is defined in the ISL parameter of the UBBCONFIG file. The host and port combination that is specified for the Bootstrap object must exactly match the ISL parameter. 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:
Error: Unofficial connection from client at <tcp/ip address/<portnumber>
For example, if the network address is specified as //TRIXIE::3500 in the ISL parameter in the UBBCONFIG file, specifying either //18.104.22.168.:3500 or //trixie:3500 in the Bootstrap object will cause the connection attempt to fail.
An BEA Tuxedo domain can have multiple IIOP Listener/Handlers. If you are accessing an BEA Tuxedo domain with multiple IIOP Listener/Handlers, you supply a list of host:port combinations to the Bootstrap object. The Bootstrap object walks through the list until it connects to an BEA Tuxedo domain. The list of IIOP Listener/Handlers can also be specified in the TOBJADDR environmental variable.
If you want to access multiple BEA Tuxedo domains, you must create a Bootstrap object for each BEA Tuxedo domain you want to access.
Obtaining References to the FactoryFinder Object
The ActiveX client application must obtain initial references to the objects that provide services for the application. The Bootstrap object is used to obtain references to the FactoryFinder object, SecurityCurrent object, TransactionCurrent object, NotificationService object, Tobj_SimpleEventsService object, and NameService object. The argument passed to the operation is a string containing the progid of the desired object. You have to get references only for the objects that you plan to use in your ActiveX client application.
The following Visual Basic example shows how to use the Bootstrap object to obtain a reference to the FactoryFinder object:
Set objFactoryFinder = objBootstrap.CreateObject("Tobj.FactoryFinder")
Using a Factory to Get an ActiveX View
ActiveX client applications get interface pointers to ActiveX views of CORBA objects from factories. A factory is any CORBA object that returns an object reference to another CORBA object. The ActiveX 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 ActiveX 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 Factories and the FactoryFinder Object.
Use the CreateObject function to create the FactoryFinder object, and then use one of the FactoryFinder object methods to find a factory. The FactoryFinder object has the following methods:
Returns a sequence of factories that match the input key exactly.
Returns one factory that matches the input key exactly.
Returns a sequence of factories whose ID field in the name component matches the input argument.
Returns one factory whose ID field in the factory's CORBA name component matches the input argument.
The following Visual Basic example shows how to use the FactoryFinder find_one_factory_by_id() method to get a factory for the Registrar object used in the client application for the Basic sample applications:
Set objRegistrarFactory = objBsFactoryFinder.find_one_factory_by_id
Set objRegistrar = RegistrarFactory.find_registrar
Invoking Operations on the ActiveX View
Invoke operations on the ActiveX view by passing it a pointer to the factory and any arguments that the operation requires.
The following Visual Basic example shows how to invoke operations on an ActiveX view:
`Get course details from the Registrar object'
aryCourseDetails = objRegistrar.get_course_details(aryCourseNumbers)
Step 7: Deploying the ActiveX Client Application
To distribute ActiveX client applications to other client machines, you need to create a deployment package. A deployment package contains all the data needed by the client application to use ActiveX views of CORBA objects, including the bindings, the type libraries, and the registration information. The deployment package is a self-registering ActiveX control with the file extension.ocx.
To create a deployment package for an ActiveX view:
A confirmation window is displayed.
By default, the deployment package is placed in \tuxdir\Packages.
Copyright © 2001 BEA Systems, Inc. All rights reserved.