Hi!
I am developing an XData server with Service operations. Here's some code that describes the
Interface definition:
unit Admin.Service.Intf;
interface
uses
System.Classes,
Generics.Collections,
XData.Service.Common,
Aurelius.Criteria.Base,
XData.Security.Attributes,
Aurelius.Mapping.Attributes,
Entities.Admin;
type
[ServiceContract]
[Model('admin')]
IAdminService = interface(IInvokable)
['{4B3C6BEF-2022-4607-9EF2-81FDCB10C51B}']
...
[HttpGet] function StartEnvironment(EnvId: integer): boolean;
end;
implementation
initialization
RegisterServiceType(TypeInfo(IAdminService));
end.
Implementation:
unit Admin.Service;
interface
uses
System.SysUtils, System.Classes, Generics.Collections, XData.Service.Common,
Entities.Admin, Aurelius.Engine.ObjectManager, Bcl.Jose.Core.JWT, Bcl.Jose.Core.Builder,
Sparkle.Security, XData.Sys.Exceptions, XData.Security.Attributes, LoggerProxy,
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.Phys.MySQLDef,
FireDAC.VCLUI.Wait, FireDAC.Comp.Client, Aurelius.Linq, Aurelius.Criteria.Linq,
Aurelius.Criteria.Base, XData.Server.Module, Aurelius.Engine.DatabaseManager,
Admin.Service.Intf
;
type
[ServiceImplementation]
TAdminService = class(TInterfacedObject, IAdminService)
private
...
function StartEnvironment(EnvId: integer): boolean;
end;
function TAdminService.StartEnvironment(EnvId: integer): boolean;
begin
var mngr := TXDATAOperationContext.Current.GetManager;
var env := mngr.Find<TEnvironment>(EnvId);
ServerContainer.StartEnvironment(env);
end;
The code compiles and executes well. I open the Swagger UI and after executing the StartEnvironment method I get the exception
Project EasyServer.Vcl.exe raised exception class
EXDataHttpMissingServiceImplementation with message
'Missing service implementation for controller "AdminService"'.
None of the service operations works. I rechecked the thing many times and can't find where I made a mistake.
Any advice would be a great start here