0 Replies Latest reply on Oct 4, 1999 12:59 PM by 3004

    C++ client and Forete server interface Using IIOP

    3004
      Hi Forte users,

      We have been experiencing problems to make a connection between a client
      program coded
      by Visual C++ and a service object in Forte using IIOP of Orbix2.
      The client program on WindowsNT called an application in Forte on same
      machine or on other WindowsNT machine.
      The client code read IOR file and called a method of the service object in
      Forte using the following client codes.
      But we got an error from client side.
      Would you give us what client codes should be?
      And also do we need any server registration procedure on Server machine?
      When I read an Orbix manual, there was a command "putit" to register the
      server in the Implementation Repository.
      We defined "IIOP" and other settings for "a Service Object Is an IIOP-IDL
      Server" as a manual on Forte and
      made "make distribution" and "installation".
      Any errors inside of the codes?

      The client codes were

      int main(int argc, char* argv[])
      {
      test_api::test_api_class *test;
      char *Str;
      FILE *fp;
      long size;
      char test11[100];
      char *test22;

      CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv,"Orbix");

      fp = fopen("Ior.ior" , "r");
      if(fp==NULL)
      return 0;
      fseek(fp , 0 , SEEK_END);
      size = ftell(fp);
      Str = (char *)malloc(sizeof(char) * (size+1)) ;
      fseek(fp , 0 , SEEK_SET);
      fread(Str , size , 1 ,fp );
      fclose( fp );

      Str[size]= 0x0;


      CORBA::String_var IORString(Str);

      try {
      CORBA::Object *obj_ptr = orb->string_to_object(IORString);
      test = test_api::test_api_class::_narrow(obj_ptr);
      }
      catch(CORBA::SystemException& se)
      return 0;
      test22 = (char *)malloc(sizeof(char) * 200);
      test->test_api_method(test11 , test22);
      return 1;
      }

      Regards,
      Jongmoon Kim
      Eftia OSS solutions