#2 mORMot 1 » First chance exception 'HTTP/1.1 403 Forbidden' (crossplatform) » 2015-05-29 13:22:02

Rob
Replies: 1

Hi,

I'm getting this exception after some time of inactivity on the client:
First chance exception at $76D54598. Exception class EIdHTTPProtocolException with message 'HTTP/1.1 403 Forbidden'. Process ClientFMX.exe (292)

I can't consistently reproduce this problem, but it only happens after some time of inactivity, not always. Any idea what might cause this ?

Thanks in advance!

#3 Re: mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-19 12:15:58

Rob
  TSQLMutuality = class(TSQLRecord)
  private
    FMutualityName: RawUTF8;
  published
    property MutualityName: RawUTF8 read FMutualityName write FMutualityName;
  end;

#4 Re: mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-19 08:21:36

Rob

like this:

 TSQLPatient = class(TSQLRecord)
  private
    FNISS: RawUTF8;
    FMutPayCode: Integer;
    FProfession, FThirdPayer: RawUTF8;
    FMutInfo: Variant;
    FNumberOfChildren: integer;
    FPayerId: integer;
    FGMDHolderId: integer;
    FContactId: integer;
    FMutualityId: integer;
    FHeadOfFamilyId: integer;
    FOldID: RawUTF8;
    FPaysAfterBooking: boolean;
    FNotifyEmail: boolean;
    FIsActive: boolean;
    FNotifyAppointment: boolean;
    FNotifySMS: boolean;
    FMutuality: TSQLMutuality;
  published
    property ContactId: integer read FContactId write FContactId;
    property HeadOfFamilyId: integer read FHeadOfFamilyId write FHeadOfFamilyId;
    property PayerId: integer read FPayerId write FPayerId;
    property IsActive: boolean read FIsActive write FIsActive;
    property MutualityId: integer read FMutualityId write FMutualityId;
    property MutPayCode: Integer read FMutPayCode write FMutPayCode;
    property GMDHolderId: integer read FGMDHolderId write FGMDHolderId;
    property ThirdPayer: RawUTF8 read FThirdPayer write FThirdPayer;
    property OldID: RawUTF8 read FOldID write FOldID;
    property PaysAfterBooking: boolean read FPaysAfterBooking write FPaysAfterBooking;
    property Profession: RawUTF8 read FProfession write FProfession;
    property NumberOfChildren: integer read FNumberOfChildren write FNumberOfChildren;
    property NotifyEmail: boolean read FNotifyEmail write FNotifyEmail;
    property NotifySMS: boolean read FNotifySMS write FNotifySMS;
    property NotifyAppointment: boolean read FNotifyAppointment write FNotifyAppointment;
    property Mutuality: TSQLMutuality read FMutuality write FMutuality;
  end;

#5 Re: mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-16 13:25:31

Rob

this is in the ctxt.Serviceparameters:
'[{"ID":4,"ContactId":0,"HeadOfFamilyId":0,"PayerId":0,"IsActive":0,"MutualityId":0,"MutPayCode":0,"GMDHolderId":0,"ThirdPayer":"","OldID":"","PaysAfterBooking":0,"Profession":"","NumberOfChildren":0,"NotifyEmail":0,"NotifySMS":0,"NotifyAppointment":0,"Mutuality":null}]'


this is an excerpt of the mormotclient.pas:

  TSQLPatient = class(TSQLRecord)
  protected
    fContactId: Integer;
    fHeadOfFamilyId: Integer;
    fPayerId: Integer;
    fIsActive: Boolean;
    fMutualityId: Integer;
    fMutPayCode: Integer;
    fGMDHolderId: Integer;
    fThirdPayer: String;
    fOldID: String;
    fPaysAfterBooking: Boolean;
    fProfession: String;
    fNumberOfChildren: Integer;
    fNotifyEmail: Boolean;
    fNotifySMS: Boolean;
    fNotifyAppointment: Boolean;
    fMutuality: TSQLMutuality;
  published
    property ContactId: Integer read fContactId write fContactId;
    property HeadOfFamilyId: Integer read fHeadOfFamilyId write fHeadOfFamilyId;
    property PayerId: Integer read fPayerId write fPayerId;
    property IsActive: Boolean read fIsActive write fIsActive;
    property MutualityId: Integer read fMutualityId write fMutualityId;
    property MutPayCode: Integer read fMutPayCode write fMutPayCode;
    property GMDHolderId: Integer read fGMDHolderId write fGMDHolderId;
    property ThirdPayer: String read fThirdPayer write fThirdPayer;
    property OldID: String read fOldID write fOldID;
    property PaysAfterBooking: Boolean read fPaysAfterBooking write fPaysAfterBooking;
    property Profession: String read fProfession write fProfession;
    property NumberOfChildren: Integer read fNumberOfChildren write fNumberOfChildren;
    property NotifyEmail: Boolean read fNotifyEmail write fNotifyEmail;
    property NotifySMS: Boolean read fNotifySMS write fNotifySMS;
    property NotifyAppointment: Boolean read fNotifyAppointment write fNotifyAppointment;
    property Mutuality: TSQLMutuality read fMutuality write fMutuality;
  end;

...

procedure TServicePatientAdministration.FillPatient(var thePatient: TSQLPatient);
var res: TVariantDynArray;
begin
  fClient.CallRemoteService(self,'FillPatient',1, // raise EServiceException on error
    [ObjectToVariant(thePatient)],res);
  thePatient := TSQLPatient.CreateFromVariant(res[0]);
end;

#6 Re: mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-16 09:49:41

Rob

Thanks I changed my code to use Retrieve.

these are the last lines of the log, I ll see if i can get anything out of debug.

20150116 10445700  (  +    TSQLRestServerKineQuick(002FB420).0019337C mORMot.TSQLRestServer.URI (29497)
20150116 10445700  ( auth      TSQLRestRoutingREST(002D05C0) User/5939437
20150116 10445700  ( call      TSQLRestServerKineQuick(002FB420) PatientAdministration.FillPatient
20150116 10445700  ( srvr      POST kq/PatientAdministration.FillPatient ERROR=400 (Shared execution failed (probably due to bad input parameters) for IPatientAdministration.FillPatient)
20150116 10445700  (  -    00.000.230
20150116 10445708  )  +    TSQLRestServerKineQuick(002FB420).0019337C mORMot.TSQLRestServer.URI (29497)
20150116 10445708  ) auth      TSQLRestRoutingREST(002D05C0) User/5939437
20150116 10445708  ) call      TSQLRestServerKineQuick(002FB420) PatientAdministration.FillPatient

#7 Re: mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-16 08:32:48

Rob

firemonkey indeed.
using this on the client gives 501 server error

lPatient := TSQLPatient.Create;
    lPatient.ID := AItem.Data['theID'].AsInteger;
    localPatAdmin.FillPatient(lPatient);

server side:

procedure TPatientAdministration.FillPatient(var thePatient: TSQLPatient);
begin
 thePatient :=  TSQLPatient.Create( ServiceContext.Request.Server, thePatient.ID);
end;

this is in the datamodel server side:

TSQLPatient = class(TSQLRecord)
  private
    FIsActive: boolean;
    FContact: TSQLContact;
published
    property IsActive: boolean read FIsActive write FIsActive;
    property Contact: TSQLContact read FContact write FContact;
end;

so everytime we pass a TSQLRecord as a parameter when we have a TSQLRecord property it gives this error or When there is a 'Variant' as a property.

I hope I was able to explain smile

#8 mORMot 1 » 501 error when using Variants or Composition CrossPlatform » 2015-01-15 14:19:14

Rob
Replies: 10

Hi,

When using a TSQLRecord or a Variant as a property of a TSQLRecord instance and then passing that TSQLRecord instance as a Paramater to a service gives a 501 server error (while using the generated CrossPlatform Client).

Does that mean we are forced to use DTO's ? Or are we doing something wrong ?

Thanks in advance,

Rob

Board footer

Powered by FluxBB