Problems using ORBit with omniORB and CosNaming



Hi,

I'm working on a system that has to make calls to objects written in C++
and compiled with omniORB 2.8. Each object registers itself with the
omniNamingService when it starts up. What I need to do is write a C
program, using ORBit 5.8.0, that can query the omniNamingService, get the
IORs of the objects, and make some calls to them.

I've based my code (closely ;) on Ron Garcia's example 5 (see
http://www.nd.edu/~rgarcia4/orbit/examples/example5/ ) except removed the
factory creation parts since the objects are already created. No
exceptions seem to be reported during the calls to the naming service, but
the program segfaults when it gets to calling the remote functions. I'm
guessing because it hasn't got the proper object reference(?).

I'm pretty sure the objects are created properly, because they can be
accessed from other omniORB/C++ objects. I tried using name-client that
comes with ORBit to examine the omniNamingService, but it says it can't
find the objects:

./name-client IOR:0203..snipped..002 resolve MotionController
'MotionController' can't be found, because 'MotionController' is missing.

A snippet of the code for the ORBit/C client is:

  char command[1024];

  Dialogue dialogue_object;	      /* Our object */
  long val;

  CORBA_ORB orb=NULL;         /* This is our ORB */

  CORBA_Environment ev;       /* CORBA exception information */

  CosNaming_NamingContext name_srv; /* The name server */
  CosNaming_Name* dialogue_name;    /* This holds the name of our server*/

  CORBA_exception_init(&ev);

  /* Initialize the orb. The initialization routine checks the command
   * line parameters for directives that affect the orb */
  orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev);

  /* Here we get the name server from the ORB and publish the server */
  name_srv =
    CORBA_ORB_resolve_initial_references(orb, "NameService", &ev);
  g_assert(ev._major != CORBA_SYSTEM_EXCEPTION);

  dialogue_name = create_name("Dialogue");

  dialogue_object =
CosNaming_NamingContext_resolve(name_srv,dialogue_name, &ev);
  g_assert(ev._major != CORBA_SYSTEM_EXCEPTION);

  reply = CORBA_ORB_object_to_string( orb, dialogue_object, &ev);

  strcpy( command, "anycommand" );

  Dialogue_echoString( dialogue_object, &command, &ev );


And I'm passing the IOR of the omniNamingService on the command line:
 ./factory-client -ORBNamingIOR=IOR:0188040...etc...002


Any ideas where I'm going wrong, and why my objects aren't found? Is
omniORB compatible with ORBit (surely it should be?). Even getting
name-client to work would be a step forward.

Hope someone can help, thanks,
Tim






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