roger
2007-08-17 09:44:12 UTC
I am posting this issue in connection with presence of firewalls in the
network. We have a firewall sitting in between client and server, filtering
packets based on TCP ports. A client invokes method on the proxy, which
leads to the server invoking a CALL BACK method on the client object.
I was going through omniORB 4.0.3 documentation and found how to achieve
Bi-directional GIOP, which allows callbacks to be made using a connection
opened by the original client. Based example on src\examples\bidir. ============server code================================================== const char* options[][2] = {
{ "traceLevel", "40" },
{ "traceExceptions", "1" },
{ "acceptBiDirectionalGIOP", "1" },
{ "serverTransportRule", "* unix,tcp,bidir" },
{ "endPoint", "giop:tcp::7788" },
{ 0, 0 }
}; // Initialise the ORB.
orb = CORBA::ORB_init(argc, argv,"omniORB4",options); {
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
//CORBA::Object_var obj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var rootpoa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = rootpoa->the_POAManager();
pman->activate(); // Create a POA with the Bidirectional policy
CORBA::PolicyList pl;
pl.length(1);
CORBA::Any a;
a <<= BiDirPolicy::BOTH;
pl[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, a); PortableServer::POA_var poa = rootpoa->create_POA("bidir", pman, pl); server_i* myserver = new server_i();
PortableServer::ObjectId_var myserver_id = PortableServer::string_to_ObjectId("bidirService");
rootpoa->activate_object_with_id(myserver_id, myserver);
//poa->activate_object_with_id(myserver_id, myserver);
PortableServer::ObjectId_var oid = poa->activate_object(myserver);
obj = myserver->_this();
myserver->_remove_ref();
CORBA::String_var sior(orb->object_to_string(obj));
cerr <<std::endl<< "Servant ObjectId£º'" << (char*) sior << "'" << endl;
orb->run();
} cerr << "bd_server: Returned from orb->run()." << endl;
orb->destroy(); ============client code================================================== const char* options[][2] = {
{ "traceLevel", "40" },
{ "traceExceptions", "1" },
{ "offerBiDirectionalGIOP", "1" },
{ "clientTransportRule", "* unix,tcp,bidir" },
{ 0, 0 }
}; // Initialise the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv,"omniORB4",options); {
CORBA::Object_var obj; // Initialise the POA.
//obj = orb->resolve_initial_references("RootPOA");
obj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var rootpoa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = rootpoa->the_POAManager();
pman->activate(); // Create a POA with the Bidirectional policy
CORBA::PolicyList pl;
pl.length(1);
CORBA::Any a;
a <<= BiDirPolicy::BOTH;
pl[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, a); PortableServer::POA_var poa = rootpoa->create_POA("bidir", pman, pl); // Get the reference the server.
std::string srv_obj_id("corbaloc::10.1.1.2:7788/bidirService");
obj = orb->string_to_object(srv_obj_id.c_str());
cb::Server_var server = cb::Server::_narrow(obj); // Register a CallBack object in this process.
cb_i* mycallback = new cb_i();
PortableServer::ObjectId_var oid = poa->activate_object(mycallback);
cb::CallBack_var callback = mycallback->_this();
mycallback->_remove_ref(); /*if( argc == 2 )
do_single(server, callback);
else
do_register(server, callback, atoi(argv[2]),atoi(argv[3]));*/
do_register(server, callback, 3,1000); }
//system("Pause");
// Clean-up. This also destroys the call-back object.
orb->destroy(); -------------------------------------------------------------It still is not working and server is unable to invoke callback method on
the client object. Is there anything I am missing here? Also, can I get an
IIOP to HTTPgateway compatible with omniORB?
-----Result-----------omniORB: throw giopStream::CommFailure from giopStream.cc:1110(0,NO,COMM_FAILURE_MarshalArguments)----------------
Thanks a lot, your help is much appreciated. roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20070817/48741f38/attachment.htm
network. We have a firewall sitting in between client and server, filtering
packets based on TCP ports. A client invokes method on the proxy, which
leads to the server invoking a CALL BACK method on the client object.
I was going through omniORB 4.0.3 documentation and found how to achieve
Bi-directional GIOP, which allows callbacks to be made using a connection
opened by the original client. Based example on src\examples\bidir. ============server code================================================== const char* options[][2] = {
{ "traceLevel", "40" },
{ "traceExceptions", "1" },
{ "acceptBiDirectionalGIOP", "1" },
{ "serverTransportRule", "* unix,tcp,bidir" },
{ "endPoint", "giop:tcp::7788" },
{ 0, 0 }
}; // Initialise the ORB.
orb = CORBA::ORB_init(argc, argv,"omniORB4",options); {
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
//CORBA::Object_var obj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var rootpoa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = rootpoa->the_POAManager();
pman->activate(); // Create a POA with the Bidirectional policy
CORBA::PolicyList pl;
pl.length(1);
CORBA::Any a;
a <<= BiDirPolicy::BOTH;
pl[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, a); PortableServer::POA_var poa = rootpoa->create_POA("bidir", pman, pl); server_i* myserver = new server_i();
PortableServer::ObjectId_var myserver_id = PortableServer::string_to_ObjectId("bidirService");
rootpoa->activate_object_with_id(myserver_id, myserver);
//poa->activate_object_with_id(myserver_id, myserver);
PortableServer::ObjectId_var oid = poa->activate_object(myserver);
obj = myserver->_this();
myserver->_remove_ref();
CORBA::String_var sior(orb->object_to_string(obj));
cerr <<std::endl<< "Servant ObjectId£º'" << (char*) sior << "'" << endl;
orb->run();
} cerr << "bd_server: Returned from orb->run()." << endl;
orb->destroy(); ============client code================================================== const char* options[][2] = {
{ "traceLevel", "40" },
{ "traceExceptions", "1" },
{ "offerBiDirectionalGIOP", "1" },
{ "clientTransportRule", "* unix,tcp,bidir" },
{ 0, 0 }
}; // Initialise the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv,"omniORB4",options); {
CORBA::Object_var obj; // Initialise the POA.
//obj = orb->resolve_initial_references("RootPOA");
obj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var rootpoa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = rootpoa->the_POAManager();
pman->activate(); // Create a POA with the Bidirectional policy
CORBA::PolicyList pl;
pl.length(1);
CORBA::Any a;
a <<= BiDirPolicy::BOTH;
pl[0] = orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, a); PortableServer::POA_var poa = rootpoa->create_POA("bidir", pman, pl); // Get the reference the server.
std::string srv_obj_id("corbaloc::10.1.1.2:7788/bidirService");
obj = orb->string_to_object(srv_obj_id.c_str());
cb::Server_var server = cb::Server::_narrow(obj); // Register a CallBack object in this process.
cb_i* mycallback = new cb_i();
PortableServer::ObjectId_var oid = poa->activate_object(mycallback);
cb::CallBack_var callback = mycallback->_this();
mycallback->_remove_ref(); /*if( argc == 2 )
do_single(server, callback);
else
do_register(server, callback, atoi(argv[2]),atoi(argv[3]));*/
do_register(server, callback, 3,1000); }
//system("Pause");
// Clean-up. This also destroys the call-back object.
orb->destroy(); -------------------------------------------------------------It still is not working and server is unable to invoke callback method on
the client object. Is there anything I am missing here? Also, can I get an
IIOP to HTTPgateway compatible with omniORB?
-----Result-----------omniORB: throw giopStream::CommFailure from giopStream.cc:1110(0,NO,COMM_FAILURE_MarshalArguments)----------------
Thanks a lot, your help is much appreciated. roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20070817/48741f38/attachment.htm