PortableServer_POA_activate_object_with_id



Hi all,

i tried to use the PortableServer_POA_activate_object_with_id()
method to set the objectkey to "Test123".
ior-decode-2 analyses the objectkey as:

    IOP_TAG_COMPLETE_OBJECT_KEY: object_key (19) '010000009e093c788b4e4cd054657374313233'

or better ior-decode says:

    Object key: "......<x.NL.Test123"

The objectkey is always 12 bytes longer than expected.

So, am I doing something wrong, or is there perhaps a bug in Orbit2?
I tried with ORBit2-2.3.108 and ORBit2-2.4.0 and ran the server with the following
options:

./hello-server -ORBIIOPUSock=0 -ORBIIOPIPv4=1 -ORBIIOPIPSock=4711.

I attache my server code and the IDL.

Regards, Marion

-- 
Marion Schuenemann

FOKUS 
Fraunhofer Research Institute for Open Communication Systems

Kaiserin-Augusta-Allee 31 
D-10589 Berlin

tel: 3463-7384    room: 2021
#include <stdio.h>
#include "hello.h"

extern POA_Hello poa_hello_servant;

int
main (int argc,
      char *argv[])
{
    CORBA_Environment ev;
    CORBA_ORB orb;
    Hello hello_client = CORBA_OBJECT_NIL;
    CORBA_PolicyList* poa_policies;
    PortableServer_ObjectId* objid = CORBA_OBJECT_NIL;
    PortableServer_POA rootpoa = CORBA_OBJECT_NIL;
    PortableServer_POAManager rootpoa_mgr;
    PortableServer_POA childpoa = CORBA_OBJECT_NIL;
    char *retval;

    CORBA_exception_init(&ev);
    orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    rootpoa = (PortableServer_POA)
      CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);
    rootpoa_mgr = PortableServer_POA__get_the_POAManager (rootpoa, &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    poa_policies           = CORBA_PolicyList__alloc ();
    poa_policies->_maximum = 1;
    poa_policies->_length  = 1;
    poa_policies->_buffer  = CORBA_PolicyList_allocbuf (1);
    CORBA_sequence_set_release (poa_policies, CORBA_TRUE);

    poa_policies->_buffer[0] = (CORBA_Policy)
      PortableServer_POA_create_id_assignment_policy(rootpoa,
                                                     PortableServer_USER_ID,
                                                     &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);
    childpoa = PortableServer_POA_create_POA(rootpoa,
                                             "User Id POA",
                                             rootpoa_mgr,
                                             poa_policies,
                                             &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    CORBA_Policy_destroy(poa_policies->_buffer[0], &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);
/*    CORBA_free(poa_policies);*/

    POA_Hello__init(&poa_hello_servant, &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    objid = PortableServer_string_to_ObjectId("Test123", &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    g_print("objid_length: %d objid_buffer: %s\n", objid->_length, objid->_buffer);
    /*g_print("objid: %s\n", PortableServer_ObjectId_to_string(objid, &ev));*/
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    PortableServer_POA_activate_object_with_id(childpoa,
                                               objid,
                                               &poa_hello_servant,
                                               &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);
    /* g_print("objid_length: %d objid_buffer: %s\n", objid->_length, objid->_buffer); */
    /* g_print("objid': %s\n", PortableServer_ObjectId_to_string(objid, &ev));
       g_assert(ev._major == CORBA_NO_EXCEPTION); */
    /*    CORBA_free (objid);*/

    hello_client = PortableServer_POA_servant_to_reference(childpoa,
                                                           &poa_hello_servant,
                                                           &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    PortableServer_POAManager_activate (rootpoa_mgr, &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    retval = CORBA_ORB_object_to_string(orb, hello_client, &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);
    puts(retval);
    CORBA_free(retval);

    CORBA_ORB_run(orb, &ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    CORBA_exception_free(&ev);
    g_assert(ev._major == CORBA_NO_EXCEPTION);

    return 0;
}
interface Hello
{
  string say_hello();
};


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]