[omniORB] omniORBpy Naming Service interop problem with TAO

Craig Rodrigues rodrigc@mediaone.net
Wed, 28 Feb 2001 14:20:12 -0500


Hi,

I created a CORBA servant using the TAO ORB.  The idl I used was
pretty simple, something like:


interface foo
{
      void some_op(in long some_param);
};

I created this servant with the TAO C++ CORBA bindings, and registered
it in the TAO naming service, using the name "MyFoo" with kind="".

I then used an omniORBpy client to try resolve the name of the foo object
from the TAO Naming Service and invoke the foo some_op() operation
on MyFoo.

When I tried this, the resolve worked, but when I tried to narrow
the object reference to foo, I got a Python "NameError" error.

My client is:
============================================================================
#!/usr/bin/env python
 
import sys
 
# Import the CORBA module
from omniORB import CORBA
 
import CosNaming
 
# Initialise the ORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
 
# Obtain a reference to the root naming context
obj         = orb.resolve_initial_references("NameService")
rootContext = obj._narrow(CosNaming.NamingContext)  
if rootContext is None:
    print "Failed to narrow the root naming context"
    sys.exit(1)
 
# Resolve the name
name = [CosNaming.NameComponent("MyFoo", "") ]
 
try:
    obj = rootContext.resolve(name)
 
except CosNaming.NamingContext.NotFound, ex:
    print "Name not found"
    sys.exit(1)
except CORBA.SystemException, ex1:
    print ex1
    sys.exit(1)

some_foo = obj._narrow(foo)

## I also tried som_foo = obj._narrow(_GlobalIDL.foo), but that failed also
============================================================================

The error I got was of the form:
Traceback (innermost last):
  File "./sender_control_clt.py", line 38, in ?
    distributor = obj._narrow(ontrol.Sender_Control)
NameError: foo

or:
Traceback (innermost last):
  File "./sender_control_clt.py", line 38, in ?
    distributor = obj._narrow(ontrol.Sender_Control)
NameError: _GlobalIDL

if I tried to do a obj._narrow(_GlobalIDL.foo)




The solution to the problem seemed to be to put my IDL inside
of a module.  However, is there another solution, so that I
can narrow objects whose IDL are not enclosed in modules?

Thanks.
-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@mediaone.net