I have a WebCore app which calls an XData Server. All is working quite well at the moment except I have this issue.
I have a service defined on the XData Server
[ServiceContract]
ICredentialsService = Interface(IInvokable)
['{3FE40512-BF91-47FB-B6CC-263AFC0752CC}']
Function SetUserCredentials(Const AUserId: Integer; Const AUserName: String; Const APassword: String;
Const AAccessLevel: String; Const AStatus: string): String;
Function RemoveCredentials(Const AUserId: Integer): boolean;
Function CurrentUserAccess(Const AUserId: Integer): TJSONObject;
End;
This is handled by a server
CredModule := TXDataServerModule.Create(SystemSettings.BaseURI + CREDENTIAL_PATH, DataPool);
CredModule.AddMiddleware(TCorsMiddleware.Create);
CredModule.AddMiddleware(TJwtMiddleware.Create(JWT_SECRET, True));
LoggingMiddleware := TLoggingMiddleware.Create(Logger);
CredModule.AddMiddleware(LoggingMiddleware);
SparkleServer.AddModule(CredModule);
Access to this is handled in the WebCore app with an object
TCredentialService = Class
Private
FClient: TXDataWebClient;
Protected
Public
Constructor Create; Reintroduce;
Destructor Destroy; Override;
procedure SetUserCredentials(Const AUserId: Integer; Const AUserName: String;
Const APassword: String; Const AAccessLevel: String; Const AStatus: String;
AOnSuccess: TOnSuccessProcEx; AOnError: TOnErrorProc);
Procedure RemoveCredentials(Const AUserId: Integer; ASuccess: TOnSuccessProc; AError: TOnErrorProc);
Procedure CurrentUserAccess(Const AUserId: Integer; AOnSuccess: TOnSuccessProcEx; AOnError: TOnErrorProc);
End;
The problem I have is that when I first make a call - it is the CurrentUserAccess method it causes an exception "TXDataWebConnection is not connected". Recalling the method works without any problems. By the looks of it is in getting TXDataWebConnection .Model that cause the issue.
I have tried pre-opening the TXDataWebConnection, but that makes no difference.
I've probably missed something, so any ideas gratefully received