[omniORB] Is this naming context path correct to retrieve the object

Rajesh Khan rajeshkhan808 at gmail.com
Thu Dec 29 10:49:16 GMT 2011


Hi I am trying to access an object passed from a C++ server to a java
server and i wanted to know if i am doing it correctly

*C++ Server Code:*
CosNaming::NamingContextExt_var rootContext;
// Obtain a reference to the root context of the Name service:
CORBA::Object_var obj;
obj = orb->resolve_initial_references("NameService");
rootContext = CosNaming::NamingContextExt::_narrow(obj);

        //Create a name called contextName
        CosNaming::Name contextName;
        contextName.length(1);
        contextName[0].id   =   (const char*) "obj";
        contextName[0].kind = (const char*) "obj";

        // Bind the context to root.
        rootContext->bind(contextName,objref); //objRef is an address to
the object that needs to be send

*Java Client Code:*
                NamingContext rootContext = null;
                NameComponent nc[] = new NameComponent[1];
                nc[0]=new NameComponent("obj","obj");
                org.omg.CORBA.Object myobj =  rootContext.resolve(nc);
                MyInterImpl = MyInterHelper.narrow(myobj);

I just wanted to know if the path to acessing the object is correct in the
above code
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111229/c063cbec/attachment.htm


More information about the omniORB-list mailing list