2 #include "tao/DynamicInterface/Request.h"
3 #include "tao/DynamicInterface/DII_CORBA_methods.h"
5 #include "ace/Get_Opt.h"
6 #include "ace/OS_NS_unistd.h"
8 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
16 while ((c
= get_opts ()) != -1)
20 ior
= get_opts
.opt_arg ();
25 ACE_ERROR_RETURN ((LM_ERROR
,
32 // Indicates successful parsing of the command line
37 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
41 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
43 if (parse_args (argc
, argv
) != 0)
46 CORBA::Object_var obj
= orb
->string_to_object(ior
);
48 const char* the_string
= 0;
50 ACE_DEBUG ((LM_INFO
, "(%P|%t) - #### Synchronous twoway DII\n"));
52 CORBA::Request_var req
= obj
->_request ("get_string");
53 req
->set_return_type (CORBA::_tc_string
);
56 req
->return_value () >>= the_string
;
58 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
61 ACE_DEBUG ((LM_INFO
, "(%P|%t) - #### Deferred twoway DII (using get_response())\n"));
63 req
= obj
->_request ("get_string");
64 req
->set_return_type (CORBA::_tc_string
);
66 req
->send_deferred ();
67 ACE_DEBUG ((LM_INFO
, "(%P|%t) - Get response...\n"));
69 req
->return_value () >>= the_string
;
71 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
74 ACE_DEBUG ((LM_INFO
, "(%P|%t) - #### Deferred twoway DII (using poll_response())\n"));
76 req
= obj
->_request ("get_string");
77 req
->set_return_type (CORBA::_tc_string
);
79 req
->send_deferred ();
82 ACE_DEBUG ((LM_INFO
, "(%P|%t) - Polling...\n"));
83 } while (!req
->poll_response ());
84 req
->return_value () >>= the_string
;
86 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
89 ACE_DEBUG ((LM_INFO
, "(%P|%t) - #### Oneway shutdown DII\n"));
91 req
= obj
->_request ("shutdown");
96 catch (const CORBA::Exception
& ex
)
98 ex
._tao_print_exception ("Exception caught:");