blob: 27a05cdf666518a31cc78177f3318a384eee67bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
//=============================================================================
/**
* @file corbaname_client.cpp
*
* This implements a simple CORBA client to tests the
* corbaname: style IOR parser
*
* @author Craig Rodrigues <crodrigu@bbn.com>
*/
//=============================================================================
#include "corbalocC.h"
#include "ace/Log_Msg.h"
int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
try
{
// First initialize the ORB, that will remove some arguments...
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if(argc < 2 )
{
ACE_ERROR_RETURN((LM_ERROR,
"Usage:\n %s [corbaname URL]\n",
argv[0]),
1);
}
// Get an object reference using a corbaname: style URL
CORBA::Object_var obj =
orb->string_to_object (argv[1]);
// Narrow
corbaloc::Status_var factory =
corbaloc::Status::_narrow (obj.in ());
if (CORBA::is_nil (factory.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: Object reference <%s> is nil\n",
argv[1]),
-1);
}
// Invoke a request on the server
CORBA::Boolean ret_value =
factory->print_status ();
if (ret_value != 0)
{
ACE_DEBUG ((LM_DEBUG,
"The server has not been contacted. Error!!\n",
0));
}
return 0;
}
catch (const CORBA::SystemException&)
{
//
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("client");
}
return 0;
}
|