Steps for developing CORBA C++ client applications
- Obtain the OMG IDL file.
- Select the Invocation type.
- Use the IDL compiler to compile the OMG IDL file. Generating client stubs
- Write the CORBA C++ client application.
- Build the CORBA C++ application
-idl command compiles the OMG IDL file and generates the client stubs required for the CORBA interface.
-The buildobjclient command constructs a CORBA C++ client application executables.
step1: Obtaining the OMG IDL file
The available interfaces and operations are provided by application designer.
step2: Selecting the Invocation Type
select static, dynamic or both.
step3: Compiling the OMG IDL File
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). You need to link these files into your CORBA client application.
step4: Writing the CORBA client Application
To get an object reference for a CORBA object and invoke operations on the object
- Intialize the BEA Tuxedo ORB.
- Establish communication with the BEA Tuxedo domain.
- Resolve initial reference to the FactoryFinder object.
- Use a factory to get an object referencefor the desired CORBA object.
- Invoke operations on the CORBA object.
syntaxb. Establishing Communication with the BEA Tuxedo Domain
CORBA::ORB_var orb=CORBA::ORB_init(argc, argv, ORBid);
if CORBA client application wants to access server applications in another BEA Tuxemo domain, you need to override the default ORBid as BEA_IIOP
The CORBA client application creates a Bootstrap object.c. Resolving Initial References to the FactoryFinder Object
The following code shows how to use the Bootstrap object:Tobj_Bootstrap* bootstrap = new Tobj_Bootstrap(orb, "//host:port");
The client application must obtain initail 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 environmental objects.
CORBA::Object_var var_factory_finder_oref = bootstrap.resolve_initial_references
("FactoryFinder");
Tobj::FactoryFinder_var var_factory_finder_ref = Tobj::FactoryFinder::_narrow
(factory_finder_oref.in());
d. Using the FactoryFinder Object to Get a Factory
CORBA client applications get object references to CORBA objects from factories.e. Using Factory to Get a CORBA Object
To use factories, the CORBA client application must be able to locate the factory it needs. The FactoryFinder object serves this purpose.
FactoryFinder object has the following methods
-find_factories()
-find_one_factory()
-find_factories_by_id()
_find_one_factory_by_id()
syntax:
CORBA::Object_var var_registrar_factory_oref = var_factory_finder_ref->
find_one_factory_by_id(UniversityB::_tc_RegistrarFactory->id());
UniversityB::RegistrarFactory_var var_RegistrarFactory_ref = UniversityB::RegistrarFactory::_narrow(var_RegistrarFactory_oref.in() );
The CORBA client applications invoke operations on the CORBA object by passing a pointer to the factory and any arguments that the operation requires.step5: Building the CORBA Client Application
The following code invoking the get_cources_details() method on the Registrar object
UniversityB::Registrar_var var_Registrar = var_RegistrarFactory->
find_Registrar();
UniversityB::CourseDetailsList_var course_details_list = Registrar_oref->
get_course_details(CourseNumberList);
Compile the code and link against the client stub.
use the buildobjclient command to construct a CORBA client application executable.
No comments:
Post a Comment