unit ProxyServer_ProxyServer_Impl; { This example shows how to create a proxy server to redirect the calls to another server without having to recreate the RODL file, thus allowing the use of the same types of the original server. In order to create this kind of proxy server you need to: 1) start a **blank** project (without any RODL, since we want to use that of the original server) and add the server and message components that the proxy will use to listen to requests. !!! See the unit fProxyServerForm.pas and the DPR of this project. There's no RODL referenced in it. 2) Link the two components via a standard dispatcher item like you would normally do. 3) Create a new TRORemotable unit like this exact file you are looking at 4) Done! This unit was created by simply copying the original MainService_Impl.pas file, renaming the TMainService class to TProxyService followed by implementing a bypass for all the method calls. This class is basically a server which accesses a RO server as a client would do. There are other possible solutions to the proxy dilemma. This one though provides more control over everything. Specifically, since every call will pass from the proxy class before going to the real server, you can stop methods from being dispatched any further. Enjoy! } interface uses {vcl:} Classes, {RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, {Generated:} ProxyServerMainLibrary_Intf, uROIndyTCPChannel, uROClient, uROBINMessage; type TProxyService = class(TRORemotable, IProxyServerMainService) private fTCPChannel: TROIndyTCPChannel; fBINMessage: TROBINMessage; function CreateService: IProxyServerMainService; protected function Sum(const A: Integer; const B: Integer): Integer; function GetServerTime: DateTime; function EchoStruct(const aTestStruct: TestStruct): TestStruct; public constructor Create; override; destructor Destroy; override; end; implementation uses {Generated:} ProxyServerMainLibrary_Invk, SysUtils; procedure Create_ProxyService(out anInstance: IUnknown); begin anInstance := TProxyService.Create; end; constructor TProxyService.Create; begin inherited; fTCPChannel := TROIndyTCPChannel.Create(nil); fBINMessage := TROBINMessage.Create(nil); end; destructor TProxyService.Destroy; begin fTCPChannel.Free; fBINMessage.Free; inherited; end; function TProxyService.CreateService: IProxyServerMainService; begin result := CoProxyServerMainService.Create(fBINMessage, fTCPChannel); end; function TProxyService.Sum(const A: Integer; const B: Integer): Integer; begin result := CreateService.Sum(A, B) end; function TProxyService.GetServerTime: DateTime; begin result := CreateService.GetServerTime end; function TProxyService.EchoStruct(const aTestStruct: TestStruct): TestStruct; begin result := CreateService.EchoStruct(aTestStruct) end; initialization TROClassFactory.Create('ProxyServerMainService', Create_ProxyService, TProxyServerMainService_Invoker); finalization end.