#1 2020-07-10 10:38:37

konsul41
Member
Registered: 2020-05-21
Posts: 24

I cannot register the service (interface).

Linux Debian server written via Lazarus.
I cannot register the service (interface).
Interface

IAuth = interface(IInvokable)
    ['{E62D2F00-CB21-42FA-8284-AD7007510857}']
    function GetListaUzytkownikow(): RawJSON;
end;

Implementation

 TAuthService = class(TInterfacedObject, IAuth)
  public
    function GetListaUzytkownikow(): RawJSON;
    function GetHierarchy(): RawJSON;
  end;

It's classic.

Server code

...
TMethodServer = class(TSQLRestServerDB)
  strict private
...

Application.Log(etInfo,'Rozpoczęcie procedury startowej');
  Model:= TSQLModel.Create ([TSQLAuthGroup, TAuthUser,TFaktura,TRaportKasowy,TRaportDobowy]);
  ServerDB:= TMethodServer.Create (Model, 'demed.db3',true);
  ServerDB.CreateMissingTables();
  ServerDB.ServiceRegister (TAuthService, [TypeInfo (IAuth)],sicClientDriven).SetOptions([],[optExecInMainThread,optFreeInMainThread]);

Error:
Project lserv raised exception class 'EServiceException' with message:
TServiceFactoryServer.Create: IAuth alredy exposed as TMethodServer published method

In file '../mormot/SQLLite3/mORMot.pas' at line 58046:
raise EServiceException.CreateUTF8('%.Create: I% alredy ...


What does it mean that it is already exposed?
How to properly register interface (service) in Lazarus on Linux?

Last edited by konsul41 (2020-07-10 10:53:21)

Offline

#2 2020-07-10 11:56:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: I cannot register the service (interface).

Your TMethodServer has a published method already called Auth, exposed at URI /root/Auth.
It is part of the standard TSQLRestServer definition, and used for authentication, as a method-based service.

So IAuth is making a conflict since it would be exposed also at URI /root/Auth.
Change IAuth to e.g. IAuthenticate and it will be accepted.

Offline

#3 2020-07-10 12:23:45

konsul41
Member
Registered: 2020-05-21
Posts: 24

Re: I cannot register the service (interface).

Of course you're right. Thanks.

I have not written anywhere yet.
Mormot is great. May the force be with you.

Offline

#4 2020-07-10 12:42:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: I cannot register the service (interface).

smile

Offline

#5 2020-07-11 16:29:45

konsul41
Member
Registered: 2020-05-21
Posts: 24

Re: I cannot register the service (interface).

Strange problem my server hangs on the ruler
TThread.Synchronize (synch.Context ^ .RunningThread, event)
line 39423 in the mormot.pas file


local variables
SYNCH={CONTEXT = 0x7ffff5e9b3e0, ACTION = DOCALLMETHOD, CALLMETHODARGS = 0x7ffff5f18898, INSTANCE = 0x7ffff5f18898, THREADMETHOD = {Proc = {procedure (POINTER)} 0x7ffff5f184a0, Self = 0x43017b}}
BACKGROUNDTHREAD=0x0
EVENT={Proc = {procedure (POINTER)} 0x7ffff5f18470, Self = 0x7ffff5f184a0}

On Client Error
TInterfacedObjectFakrClient.FakeCall(IAdmin1.GetList...
failed: 'URI root/Admin1.GetListaUzytkownikow/2 []
returned status 'Not Implemented' (501 - Server not reachable or broken connection)'

After closing the message, communication with the server in a different scope is normal. So the connection was not broken.

If you could direct me where to look next

Last edited by konsul41 (2020-07-13 05:25:17)

Offline

Board footer

Powered by FluxBB