[omniORB] Naming across ORBS
David Hyde
davidh@cavendish.co.uk
Mon, 6 Sep 1999 13:40:34 +0100
Hello,
I am trying to access an Expersoft CORBAplus written server from an OmniOrb
client (on the same machine). I've done it by passing the stringified
reference to the object that I want to connect to into the client on the
command line, but I can't seem to do it through the naming service. Here's
what I'm doing...
>From my server:
// Initialise the ORB
orb = CORBA::ORB_init(Myargc, Myargv);
if (!CORBA::is_nil(orb))
// Initialise the BOA
CORBA::BOA_ptr aboa = orb->BOA_init(Myargc, Myargv);
XpsBOA * pboa = XpsBOA::_narrow(aboa);
if (!CORBA::is_nil(pboa))
{
// resolve a reference to the NamingService
CORBA::Object_ptr obj =
orb->resolve_initial_references("NameService");
if (!CORBA::is_nil(obj))
{
// narrow to a Naming Context
CosNaming::NamingContext_ptr pNC =
CosNaming::NamingContext::_narrow(obj);
if (!CORBA::is_nil(pNC))
{
CORBA::String_var p;
// Get the stringified Naming Service object and
output it
p = orb->object_to_string(pNC);
cout << endl << "Stringified Naming Service object
is:" << endl << (char*)p << endl << endl;
The client looks like this:
CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv,"omniORB2");
CORBA::BOA_ptr boa = orb->BOA_init(argc,argv,"omniORB2_BOA");
CORBA::Object_ptr obj = orb->resolve_initial_references("NameService");
if (!CORBA::is_nil(obj))
{
...
I place the string output by the server (including the "IOR:") into the
registry, but when I run the client I get an immediate exception and:
Configuration error: Invalid object reference supplied for
NAMESERVICE.
I've even tried:
CORBA::Object_var ncObj = orb->string_to_object(argv[1]);
CosNaming::NamingContext_var pNC = CosNaming::NamingContext::_narrow(ncObj);
whilst placing OmniORB's IOR into the registry. _narrow then returns NULL.
As far as I can see what I want to do shouldn't be too difficult, so can
anyone point me in the right direction please.
Thanks very much
David Hyde