4 #include "tao/ObjectIdListC.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/OS_NS_string.h"
10 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
16 // Retrieve a reference to the ORB.
17 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
22 "No Name specified to be resolved\n"));
26 CORBA::Object_var objref
;
28 for (i
= 1; i
< argc
; ++i
)
30 if (ACE_OS::strcmp (argv
[i
], ACE_TEXT("-l")) == 0)
32 // List initial services
33 CORBA::ORB::ObjectIdList_var list
=
34 orb
->list_initial_services ();
36 size_t length
= list
->length ();
41 "Listing initial references...\n"));
43 for (CORBA::ULong n
= 0; n
< length
; ++n
)
46 " Reference %u: %C\n",
48 static_cast<char const*>(list
[n
])));
53 // We should at least get TAO's initial references,
54 // such as "RootPOA", "NameService", etc.
55 ACE_ERROR_RETURN ((LM_ERROR
,
57 "No initial references. "
58 "This condition shouldn't happen.\n"),
64 objref
= orb
->resolve_initial_references (ACE_TEXT_ALWAYS_CHAR(argv
[i
]));
66 if (CORBA::is_nil (objref
.in ()))
67 ACE_ERROR_RETURN ((LM_ERROR
,
68 " (%P|%t) Unable to resolve the "
72 INS_var server
= INS::_narrow (objref
.in ());
74 CORBA::String_var iorstr
=
75 orb
->object_to_string (server
.in ());
77 "Resolved IOR for %s : %C\n",
81 CORBA::String_var test_ins_result
=
85 "\nResult of Remote Call : %C\n",
86 test_ins_result
.in ()));
90 catch (const CORBA::ORB::InvalidName
& )
92 ACE_DEBUG ((LM_DEBUG
, "Cannot resolve <%s>\n", argv
[i
]));
94 catch (const CORBA::Exception
& ex
)
96 ex
._tao_print_exception ("Exception:");