1 #include "Two_ObjectsC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
7 parse_args (int argc
, ACE_TCHAR
*argv
[])
9 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("r:"));
12 while ((c
= get_opts ()) != -1)
16 ior
= get_opts
.opt_arg ();
21 ACE_ERROR_RETURN ((LM_ERROR
,
28 // Indicates successful parsing of the command line
33 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
35 // Used to declare the CORBA::Environment variable
41 CORBA::ORB_init (argc
, argv
);
43 // Parse the arguments
44 if (parse_args (argc
, argv
) != 0)
47 // Convert the ior string to an object reference.
48 // The object reference obtained is a reference to the factory
50 CORBA::Object_var tmp
=
51 orb
->string_to_object(ior
);
53 // Narrow the object reference to the appropriate type
54 Two_Objects_Test::Object_Factory_var factory
=
55 Two_Objects_Test::Object_Factory::_narrow(tmp
.in ());
57 if (CORBA::is_nil (factory
.in ()))
59 ACE_ERROR_RETURN ((LM_DEBUG
,
60 "Nil Two_Objects_Test::Object_Factory reference <%s>\n",
65 Two_Objects_Test::First_var first
;
66 Two_Objects_Test::Second_var second
;
68 // Use the factory object to create the first and second interfaces
69 first
= factory
->create_first();
70 second
= factory
->create_second();
72 // Call the oneway method
73 first
->oneway_method ();
75 ACE_DEBUG ((LM_DEBUG
, "Client : one way call done\n"));
77 Two_Objects_Test::Octet_Seq_var reply_seq
=
78 second
->twoway_method ();
80 ACE_DEBUG ((LM_DEBUG
, "Client : length of returned data is %d\n",
81 reply_seq
->length() ));
87 catch (const CORBA::Exception
& ex
)
89 ex
._tao_print_exception ("Exception caught:");