Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / mfc / client.cpp
blob55daf764cee575989b5137977166c913b6658103
1 #include "w32_testS.h"
2 #include "ace/streams.h"
4 int
5 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
7 try
9 ACE_DEBUG ((LM_DEBUG,
10 "Initializing the ORB!\n"));
11 CORBA::ORB_var the_orb = CORBA::ORB_init (argc, argv);
13 CORBA::Object_var orb_obj =
14 the_orb->resolve_initial_references ("RootPOA");
16 PortableServer::POA_var the_root_poa =
17 PortableServer::POA::_narrow (orb_obj.in ());
19 PortableServer::POAManager_var the_poa_manager =
20 the_root_poa->the_POAManager ();
22 // Retrieving the servants IOR from a file
23 ACE_DEBUG ((LM_DEBUG,
24 "Reading the IOR!\n"));
26 const ACE_TCHAR *filename = ACE_TEXT("file://ior.txt");
28 orb_obj =
29 the_orb->string_to_object (filename);
31 ACE_DEBUG ((LM_DEBUG,
32 "Narrowing the IOR!\n"));
34 W32_Test_Interface_var mycall =
35 W32_Test_Interface::_narrow (orb_obj.in ());
37 ACE_DEBUG ((LM_DEBUG,
38 "Sending the Request!\n"));
39 char *response = mycall->getresponse (1);
40 ACE_DEBUG ((LM_DEBUG,
41 "The answer ...%s\n", response));
43 // Free up the string.
44 CORBA::string_free (response);
46 catch (const CORBA::Exception& ex)
48 ex._tao_print_exception ("Caught exception:");
49 return 1;
52 return 0;