Loging metod call

(teo59) #1

Is there a possibility of loging call methods and DA objects on the server per session,
Delphi XE3 , RO is 9.1.99


(EvgenyK) #2


can you rephrase your q, pls?

(teo59) #3

I want intercept every method execution and loging method name and session

(EvgenyK) #4

How do you want to intercept every request?

  • for example, you can use OnReadFromStream/OnWriteToStream events of Server component. here you can get client’s request and server’s response.

  • if you want just get information about client, you can use OnGetDispatchInfo event of _Impl. see code snippet in Receiving information about client on server-side topic

  • another way - create descendant of TROInvoker and override CustomHandleMessage method.

old code:

  fClassFactory := TROClassFactory.Create('MegaDemoService', Create_MegaDemoService, TMegaDemoService_Invoker);

new one:

 TMyMegaDemoService_Invoker = class(TMegaDemoService_Invoker)
    function CustomHandleMessage(const aFactory: IROClassFactory;
      const aMessage: IROMessage;
      const aTransport: IROTransport;
      out oResponseOptions: TROResponseOptions): boolean; override;
  fClassFactory := TROClassFactory.Create('MegaDemoService', Create_MegaDemoService, TMyMegaDemoService_Invoker);

in TMyMegaDemoService_Invoker.CustomHandleMessage you can allow/disallow execution of server’s method