blob: bc4b918404d1481893914948c95db81ebb9fc10f (
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
|
// $Id$
#include "w32_testS.h"
#include "ace/streams.h"
int
main (int argc, char *argv[])
{
ACE_TRY_NEW_ENV
{
const char *orb_name = "";
ACE_DEBUG ((LM_DEBUG,
"Initializing the ORB!\n"));
CORBA::ORB_var the_orb = CORBA::ORB_init (argc,
argv,
orb_name
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::Object_var orb_obj =
the_orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
PortableServer::POA_var the_root_poa =
PortableServer::POA::_narrow (orb_obj.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
PortableServer::POAManager_var the_poa_manager =
the_root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
// Retrieving the servants IOR from a file
ACE_DEBUG ((LM_DEBUG,
"Reading the IOR!\n"));
const char *filename =
"file://ior.txt";
orb_obj =
the_orb->string_to_object (filename ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG,
"Narrowing the IOR!\n"));
W32_Test_Interface_var mycall =
W32_Test_Interface::_narrow (orb_obj.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG,
"Sending the Request!\n"));
char *response = mycall->getresponse (1);
ACE_DEBUG ((LM_DEBUG,
"The answer ...%s\n", response));
// Free up the string.
CORBA::string_free (response);
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"Caught exception:");
return 1;
}
ACE_ENDTRY;
return 0;
}
|