Example #1
0
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try
    {

      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var tmp =
        orb->string_to_object(ior);

      CORBA::InterfaceDef_var ifd = tmp->_get_interface();

      if ( ! CORBA::is_nil (ifd.in()))
      {
        CORBA::InterfaceDef::FullInterfaceDescription *id = ifd->describe_interface();

        CORBA::TypeCode_var paramType (id->operations[0].parameters[0].type.in());
        if (paramType->member_count () != 2)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            ACE_TEXT("ERROR Incorrect parameter member count %d expected 2.\n"),
                            paramType->member_count ()),
                            1);
        }
        CORBA::TypeCode_var exceptionType (id->operations[0].exceptions[0].type.in());
        if (exceptionType->member_count () != 1)
        {
          ACE_ERROR_RETURN((LM_ERROR,
                            ACE_TEXT("ERROR Incorrect exception member count %d expected 1.\n"),
                            exceptionType->member_count ()),
                            1);
        }
      }
      else
      {
        ACE_ERROR_RETURN((LM_ERROR,
                          ACE_TEXT("ERROR failed to get interface for object.\n")),
                          1);
      }

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
      return 1;
    }

  return 0;
}
Example #2
0
File: client.cpp Project: CCJY/ATCD
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var tmp =
        orb->string_to_object(ior);

      CORBA::InterfaceDef_var ifd = tmp->_get_interface();
      if ( ! CORBA::is_nil (ifd.in()))
      {
        CORBA::InterfaceDef::FullInterfaceDescription *id = ifd->describe_interface();
        if ( id == 0 )
        {
          ACE_ERROR ((LM_ERROR,
                             ACE_TEXT("Null interface description returned\n")));
        }

      }
      Test::GoodDay_var goodday =
        Test::GoodDay::_narrow(tmp.in ());

      if (CORBA::is_nil (goodday.in ()))
        {
          ACE_ERROR ((LM_DEBUG,
                             ACE_TEXT("Nil Test::GoodDay reference <%s>\n"),
                             ior));
        }
      else
      {

        CORBA::String_var the_string =
          goodday->get_string ();

        ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) - string returned <%s>\n"),
                    the_string.in ()));
      }

      goodday->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
      return 1;
    }
  return 0;
}