3 #include "Client_ORBInitializer.h"
5 #include "tao/ORBInitializer_Registry.h"
7 #include "ace/Get_Opt.h"
8 #include "ace/Argv_Type_Converter.h"
10 const ACE_TCHAR
*ior
= 0;
13 parse_args (int argc
, ACE_TCHAR
*argv
[])
15 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT ("k:"));
18 while ((c
= get_opts ()) != -1)
22 ior
= get_opts
.opt_arg ();
25 ACE_ERROR_RETURN ((LM_ERROR
,
26 ACE_TEXT ("Usage: %s ")
27 ACE_TEXT ("-k IOR\n"),
36 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
42 #if TAO_HAS_INTERCEPTORS == 1
43 PortableInterceptor::ORBInitializer_ptr temp_initializer
=
44 PortableInterceptor::ORBInitializer::_nil ();
46 ACE_NEW_RETURN (temp_initializer
,
47 Client_ORBInitializer
,
48 -1); // No exceptions yet!
49 PortableInterceptor::ORBInitializer_var orb_initializer
=
52 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
53 #endif /* TAO_HAS_INTERCEPTORS == 1 */
55 ACE_Argv_Type_Converter
narrow (argc
, argv
);
57 CORBA::ORB_init (narrow
.get_argc (), narrow
.get_ASCII_argv (), "ClientORB");
59 ACE_Argv_Type_Converter
wide (narrow
.get_argc (), narrow
.get_ASCII_argv ());
60 if (::parse_args (wide
.get_argc (), wide
.get_TCHAR_argv ()) != 0)
63 CORBA::Object_var object
=
64 orb
->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior
));
66 hello::GoodDay_var server
=
67 hello::GoodDay::_narrow (object
.in ());
69 if (CORBA::is_nil (server
.in ()))
71 ACE_ERROR_RETURN ((LM_ERROR
,
72 ACE_TEXT ("Object reference <%s> is nil\n"),
77 for (int i
= 1; i
<= 3; ++i
)
80 ACE_TEXT ("CLIENT: Issuing request %d.\n"),
83 CORBA::Short number
= server
->number ();
86 ACE_TEXT ("CLIENT: Request %d returns %d.\n"),
95 catch (const CORBA::Exception
& ex
)
97 ex
._tao_print_exception ("Caught exception:");