[omniORB] CORBA Conceptual Question

Rajesh Khan rajeshkhan808 at gmail.com
Fri Dec 23 02:14:24 GMT 2011


I was going over Steve Vinoskis Book and it states that the client makes a
request and is blocked until it receives a response from the server.
Since i was working with the Echo example provided in OmniOrb . Please let
me know if my conclusion is correct or not which is at the end


An outline of the binding part of server is: (This just shows an overview
of how an object is registered with the naming service.
static CORBA::Boolean bindObjectToName(CORBA::ORB_ptr orb,
CORBA::Object_ptr objref)
{
       ......
       CosNaming::NamingContext_var rootContext;

        // Bind a context called "test" to the root context:
        CosNaming::Name contextName;
        contextName.length(1);
        contextName[0].id   = (const char*) "test";       // string copied
        contextName[0].kind = (const char*) "my_context"; // string copied


        CosNaming::NamingContext_var testContext;
        testContext = rootContext->bind_new_context(contextName);

        // Bind objref with name Echo to the testContext:
        CosNaming::Name objectName;
        objectName.length(1);
        objectName[0].id   = (const char*) "Echo";   // string copied
        objectName[0].kind = (const char*) "Object"; // string copied

         testContext->bind(objectName, objref);
}

orb->run();

Now the client code abstract code is (This shows how the object is
retrieved from the naming service)

static CORBA::Object_ptr getObjectReference(CORBA::ORB_ptr orb)
{
    CosNaming::NamingContext_var rootContext;
    CORBA::Object_var obj;
    obj = orb->resolve_initial_references("NameService");

    // Narrow the reference returned.
    rootContext = CosNaming::NamingContext::_narrow(obj);

    // Create a name object, containing the name test/context:
    CosNaming::Name name;
    name.length(2);

    name[0].id   = (const char*) "test";       // string copied
    name[0].kind = (const char*) "my_context"; // string copied

    name[1].id   = (const char*) "Echo";
    name[1].kind = (const char*) "Object";

    return rootContext->resolve(name);
}

*From the above example I have concluded that It seems as if the server
must have the object ready and registered in the naming service before the
Client could request and use it. In other words the server must have
knowledge in advance of what objects could be requested by the client i.
Is this correct ??
I wanted to know is it possible for the client to pass a string to the
server and based on that string the server could assemble a new object.  If
so any idea how or what should i look into the book ??
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111223/3d645b23/attachment.htm


More information about the omniORB-list mailing list