// // Test for etherealize/incarnate // #include "hello.h" #ifdef HAVE_ANSI_CPLUSPLUS_HEADERS #include #else // HAVE_ANSI_CPLUSPLUS_HEADERS #include #endif // HAVE_ANSI_CPLUSPLUS_HEADERS #include using namespace std; CORBA::ORB_ptr orb = CORBA::ORB::_nil(); class HelloWorld_impl : virtual public POA_HelloWorld { public: void hello(); }; void HelloWorld_impl::hello() { wcout << "Hello World" << endl; wcout << "client credentials: " << endl; CORBA::Object_var obj = orb->resolve_initial_references ("TransportSecurity::SecurityCurrent"); TransportSecurity::SecurityCurrent_var current = TransportSecurity::SecurityCurrent::_narrow(obj); assert(!CORBA::is_nil(current)); TransportSecurity::ClientCredentials_ptr creds = current->client_credentials(); //cerr << "creds: " << creds << endl; MICOSL3Utils::PP::indent(&wcout); MICOSL3Utils::PP::print_client_credentials(&wcout, creds); wcout << endl; } int main (int argc, char *argv[]) { wcout << "wcout init" << endl; try { orb = CORBA::ORB_init(argc, argv); CORBA::Object_var poaobj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(poaobj); PortableServer::POAManager_var mgr = poa->the_POAManager(); HelloWorld_impl* servant = new HelloWorld_impl; PortableServer::ObjectId_var oid = poa->activate_object(servant); CORBA::Object_var ref = poa->id_to_reference(oid.in()); ofstream of ("hello.ref"); CORBA::String_var str = orb->object_to_string(ref); of << str.in() << endl; of.close(); wcout << "Running." << endl; mgr->activate(); orb->run(); } catch (CORBA::UserException& ex) { wcout << "UserException caught: " << ex._repoid() << endl; } catch (CORBA::SystemException_catch& ex) { wcout << "SystemException caught: " << ex._repoid() << endl; } catch (...) { wcout << "... caught!" << endl; } return 0; }