1 #include "tao/DynamicInterface/Request.h"
4 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
10 parse_args (int argc
, ACE_TCHAR
*argv
[])
12 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
15 while ((c
= get_opts ()) != -1)
19 ior
= get_opts
.opt_arg ();
24 ACE_ERROR_RETURN ((LM_ERROR
,
31 // Indicates successful parsing of the command line
36 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
41 CORBA::ORB_init (argc
, argv
);
43 if (parse_args (argc
, argv
) != 0)
46 CORBA::Object_var tmp
=
47 orb
->string_to_object(ior
);
49 Test::Hello_var hello
=
50 Test::Hello::_narrow (tmp
.in ());
52 if (CORBA::is_nil (hello
.in ()))
54 ACE_ERROR_RETURN ((LM_DEBUG
,
55 "Nil Test::Hello reference\n"),
59 CORBA::Request_var request
;
60 request
= tmp
->_request ("get_helloworld");
61 request
->set_return_type (Test::_tc_HelloWorld
);
64 any
<<= "Hi From DOC Group";
65 request
->arguments ()->add_value ("msg", any
, CORBA::ARG_IN
);
69 CORBA::NamedValue_ptr results
= request
->result ();
70 CORBA::Any
* obj_any
= results
->value ();
72 CORBA::Object_var obj2
;
73 *obj_any
>>= CORBA::Any::to_object (obj2
);
74 if (CORBA::is_nil (obj2
.in ()))
76 ACE_ERROR_RETURN ((LM_DEBUG
,
77 "Nil Any_To_Object reference\n"),
81 Test::HelloWorld_var hello_world
=
82 Test::HelloWorld::_narrow (obj2
.in ());
84 if (CORBA::is_nil (hello_world
.in ()))
86 ACE_ERROR_RETURN ((LM_DEBUG
,
87 "Nil Test::HelloWorld reference\n"),
91 CORBA::String_var the_string
=
92 hello_world
->get_string ();
94 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
101 catch (const CORBA::Exception
& ex
)
103 ex
._tao_print_exception ("Exception caught:");