[PolyORB-users] PolyORB / Mico interoperability problems?

Vadim Godunko vgodunko at rostel.ru
Fri May 19 09:51:56 CEST 2006


Rémi Lafage wrote:
> 
> 2) I try to implement deffered callback pattern. IDL definitions look 
> like :
> 
> On the Ada server side, request method is implemented
> to use the Callback reference passed as parameter calling callback(cbk),
> but on this call I get a CORBA COMM exception without other information.
> 
This is also may be a PolyORB's bug. Can you please run attached 
programs (just type make)?


-- 
Vadim Godunko

Technoserv A/S
Rostov-on-Don, Russia
-------------- next part --------------

all: build
	cd build && idlac -I.. test.idl
	cd build && gnatmake -I.. server.adb `polyorb-config`
	cd build && gnatmake -I.. client.adb `polyorb-config`
	cd build && gnatmake -I.. request.adb `polyorb-config`
	./build/server | tee server.ior &
	./build/client | tee client.ior &
	./build/request `cat server.ior` `cat client.ior`
	killall server
	killall client

build:
	mkdir build

clean:
	rm -rf build \
		testcallback.ad[sb] testcallback-helper.ad[sb] \
		testcallback-skel.ad[sb] testclient.ad[sb] \
		testclient-helper.ad[sb] testclient-skel.ad[sb] \
		testserver.ad[sb] testserver-helper.ad[sb] \
		testserver-skel.ad[sb] server.ior client.ior
-------------- next part --------------
with Ada.Text_IO;

with CORBA.Impl;
with CORBA.Object;
with CORBA.ORB;

with PortableServer.POA.Helper;
with PortableServer.POAManager;

with TestClient.Impl;

--  Setup server node: use no tasking default configuration

with PolyORB.Setup.No_Tasking_Server;
pragma Warnings (Off, PolyORB.Setup.No_Tasking_Server);

procedure Client is
begin

   declare
      Argv : CORBA.ORB.Arg_List := CORBA.ORB.Command_Line_Arguments;

   begin
      CORBA.ORB.Init (CORBA.ORB.To_CORBA_String ("ORB"), Argv);

      declare
         Root_POA : PortableServer.POA.Ref;

         Ref : CORBA.Object.Ref;

         Obj : constant CORBA.Impl.Object_Ptr := new TestClient.Impl.Object;

      begin

         --  Retrieve Root POA

         Root_POA := PortableServer.POA.Helper.To_Ref
           (CORBA.ORB.Resolve_Initial_References
            (CORBA.ORB.To_CORBA_String ("RootPOA")));

         PortableServer.POAManager.Activate
           (PortableServer.POA.Get_The_POAManager (Root_POA));

         --  Set up new object

         Ref := PortableServer.POA.Servant_To_Reference
           (Root_POA, PortableServer.Servant (Obj));

         --  Output IOR

         Ada.Text_IO.Put_Line
           (CORBA.To_Standard_String (CORBA.Object.Object_To_String (Ref)));
         Ada.Text_IO.New_Line;

         --  Launch the server

         CORBA.ORB.Run;
      end;
   end;
end Client;
-------------- next part --------------

with Ada.Command_Line;
with Ada.Text_IO;
with CORBA.ORB;

with TestCallback;
with TestServer;

with PolyORB.Setup.Client;
pragma Warnings (Off, PolyORB.Setup.Client);

procedure Request is
   use Ada.Command_Line;
   use Ada.Text_IO;

   Server_Ref   : TestServer.Ref;
   Callback_Ref : TestCallback.Ref;

begin
   CORBA.ORB.Initialize ("ORB");

   if Argument_Count /= 2 then
      Put_Line
        ("usage : request <IOR_string_from_server> <IOR_string_from_client>");

      return;
   end if;

   --  Getting the CORBA.Object

   CORBA.ORB.String_To_Object
     (CORBA.To_CORBA_String (Ada.Command_Line.Argument (1)), Server_Ref);
   CORBA.ORB.String_To_Object
     (CORBA.To_CORBA_String (Ada.Command_Line.Argument (2)), Callback_Ref);

   Put_Line ("Issue request");

   --  Sending message

   TestServer.request (Server_Ref, Callback_Ref);

exception
   when E : CORBA.Transient =>
      declare
         Memb : CORBA.System_Exception_Members;
      begin
         CORBA.Get_Members (E, Memb);
         Put ("received exception transient, minor");
         Put (CORBA.Unsigned_Long'Image (Memb.Minor));
         Put (", completion status: ");
         Put_Line (CORBA.Completion_Status'Image (Memb.Completed));
      end;
end Request;
-------------- next part --------------
with Ada.Text_IO;

with CORBA.Impl;
with CORBA.Object;
with CORBA.ORB;

with PortableServer.POA.Helper;
with PortableServer.POAManager;

with TestServer.Impl;

--  Setup server node: use no tasking default configuration

with PolyORB.Setup.No_Tasking_Server;
pragma Warnings (Off, PolyORB.Setup.No_Tasking_Server);

procedure Server is
begin

   declare
      Argv : CORBA.ORB.Arg_List := CORBA.ORB.Command_Line_Arguments;

   begin
      CORBA.ORB.Init (CORBA.ORB.To_CORBA_String ("ORB"), Argv);

      declare
         Root_POA : PortableServer.POA.Ref;

         Ref : CORBA.Object.Ref;

         Obj : constant CORBA.Impl.Object_Ptr := new TestServer.Impl.Object;

      begin

         --  Retrieve Root POA

         Root_POA := PortableServer.POA.Helper.To_Ref
           (CORBA.ORB.Resolve_Initial_References
            (CORBA.ORB.To_CORBA_String ("RootPOA")));

         PortableServer.POAManager.Activate
           (PortableServer.POA.Get_The_POAManager (Root_POA));

         --  Set up new object

         Ref := PortableServer.POA.Servant_To_Reference
           (Root_POA, PortableServer.Servant (Obj));

         --  Output IOR

         Ada.Text_IO.Put_Line
           (CORBA.To_Standard_String (CORBA.Object.Object_To_String (Ref)));
         Ada.Text_IO.New_Line;

         --  Launch the server

         CORBA.ORB.Run;
      end;
   end;
end Server;
-------------- next part --------------

interface TestCallback {
    oneway void callback ();
};

interface TestServer {
    oneway void request (in TestCallback cb);
};

interface TestClient : TestCallback {
};
-------------- next part --------------
with Ada.Text_IO;

with TestCallback.Skel;
pragma Warnings (Off, TestCallback.Skel);

package body TestCallback.Impl is

   procedure callback (Self : access Object) is
   begin
      Ada.Text_IO.Put_Line ("Called back");
   end callback;

end TestCallback.Impl;
-------------- next part --------------
-------------------------------------------------
--  This file has been generated automatically
--  by IDLAC (http://libre.adacore.com/polyorb/)
-------------------------------------------------
pragma Style_Checks ("NM32766");

with PortableServer;

package TestCallback.Impl is

   type Object is
     new PortableServer.Servant_Base with private;

   type Object_Ptr is access all Object'Class;

   procedure callback
     (Self : access Object);

private

   type Object is
     new PortableServer.Servant_Base with record
      --  Insert components for implementation object state
      null;
   end record;

end TestCallback.Impl;
-------------- next part --------------
-------------------------------------------------
--  This file has been generated automatically
--  by IDLAC (http://libre.adacore.com/polyorb/)
-------------------------------------------------
pragma Style_Checks ("NM32766");

with TestCallback.Impl;
pragma Elaborate_All (TestCallback.Impl);

package TestClient.Impl is

   type Object is
     new TestCallback.Impl.Object with private;

   type Object_Ptr is access all Object'Class;

private

   type Object is
     new TestCallback.Impl.Object with record
      --  Insert components for implementation object state
      null;
   end record;

end TestClient.Impl;
-------------- next part --------------

with TestServer.Skel;
pragma Warnings (Off, TestServer.Skel);

package body TestServer.Impl is

   procedure request
     (Self : access Object;
      cb   : in     TestCallback.Ref)
   is
   begin
      TestCallback.callback (cb);
   end request;

end TestServer.Impl;
-------------- next part --------------
-------------------------------------------------
--  This file has been generated automatically
--  by IDLAC (http://libre.adacore.com/polyorb/)
-------------------------------------------------
pragma Style_Checks ("NM32766");

with TestCallback;
with PortableServer;

package TestServer.Impl is

   type Object is
     new PortableServer.Servant_Base with private;

   type Object_Ptr is access all Object'Class;

   procedure request
     (Self : access Object;
      cb : in TestCallback.Ref);

private

   type Object is
     new PortableServer.Servant_Base with record
      --  Insert components for implementation object state
      null;
   end record;

end TestServer.Impl;


More information about the PolyORB-users mailing list