You are not logged in.
Pages: 1
Hi Arnaud,
It currently seems impossible to support functions in interfaces that do not require parameters?
for instance
interface IServerInfo
function IsRunning: Boolean;
end;
will return an error if the caller does a /server/isRunning
However, if I add any parameters to the URL, it works... e.g. /server/isRunning?random=13348
I believe this is due to checks for parameter list <> nil
Could there be an exception to this check for occurrences where the function is not expecting any parameters?
Offline
Weird.
The regression tests contains signature like this:
ITestUser = interface(IInvokable)
['{EABB42BF-FD08-444A-BF9C-6B73FA4C4788}']
function GetContextSessionID: integer;
function GetContextSessionUser: integer;
function GetContextSessionGroup: integer;
end;
Which kind of client are you using?
What is your server configuration (routing, service options, etc...)?
Have you simple code to reproduce the issue?
Online
Hi Arnaud,
I'm just calling it from the browser via http://localhost:8080/admin/AdminServer/isRunning
Very simple to reproduce:
IAdminServer = interface(IInvokable)
['{E3097205-9424-427E-B6B4-D61E044CC6C3}']
function IsRunning: Boolean;
end;
TAdminServer = class(TInterfacedObject, IAdminServer)
public
function IsRunning: Boolean;
end;
function TAdminServer.IsRunning: Boolean;
begin
Result := True;
end;
// ---- snip ----
AdminModel := TSQLModel.Create([TSQLUser], 'admin');
AdminDB := TSQLRestServerDB.Create(AdminModel, 'admin.db', False);
AdminServer := TSQLHttpServer.Create('8080', [AdminDB], '+', useHttpApiRegisteringURI, 32, secNone);
AdminServer.AccessControlAllowOrigin := '*';
AdminDB.ServiceRegister(TAdminServer, [TypeInfo(IAdminServer)], sicShared);
Code fails in mORMot.pas line 27791 because Par is nil, and the if statement is trying to perform character matching.
If I amend the line to
if (Par<>nil) and ((Par^='[') or IdemPChar(Par,'%5B')) then
it still fails at line 27047 of mORMot.pas because as long as the parameter list is nil, it will exit with an error.
Offline
Interface based services were not meant to be used as such, directly from the browser, in fact!
You have much more ideas than us!
OK - now interface-based services allow to be called without any input parameter (i.e. no incoming HTTP body, nor value encoded at URI level).
In this case, default values will be set for the method call.
See http://synopse.info/fossil/info/54f5c7839c
Online
Thanks Arnaud!
Offline
Pages: 1