Data not received in XData Service Method

I have an object that is used in a service call

IUserManagerService = Interface(IInvokable)
    ['{8641AA90-0516-4701-8BB0-90B1CC3E571C}']
    Function UpdateUser(const AUser: TAppUser): TAppUser;
end;

The object is defined (there are a few other fields but cut for a bit of brevity)

TAppUser = Class
  Private
    FId: String;
    FFirstName: String;
    FLastName: String;
    FEmail: String;
    FUserScope: String;
    FTenantId: String;
    FUserStatus: String;
    Function GetIsAdmin: Boolean;
    Function GetUserScope: TUserScope;
    Procedure SetUserScope(Const Value: TUserScope);
    Function GetUserStatus: TUserStatus;
    Procedure SetUserStatus(Const Value: TUserStatus);
{$IFDEF PAS2JS}
    Function GetFullName: String;
    Function GetInitials: String;
{$ENDIF}
  Public
{$IFDEF PAS2JS}
    Procedure Assign(Value: JS.TJSObject);
{$ENDIF}
    Property Id: String Read FId Write FId;
    Property FirstName: String Read FFirstName Write FFirstName;
    Property LastName: String Read FLastName Write FLastName;
    Property Email: String Read FEmail Write FEmail;
    Property UserScope: String Read FUserScope Write FUserScope;
	Property TenantId: String Read FTenantId Write FTenantId;
	Property UserStatus: String Read FUserStatus Write FUserStatus; 
	Property User_Status: TUserStatus Read GetUserStatus Write SetUserStatus;
    Property User_Scope: TUserScope Read GetUserScope Write SetUserScope;
    Property JobPosition: String Read FJobPosition Write FJobPosition;hIdType;
    Property IsAdmin: Boolean Read GetIsAdmin;
{$IFDEF PAS2JS}
    Property FullName: String Read GetFullName;
    Property Initials: String Read GetInitials;
{$ENDIF}
  End;

The update is sent from a WebCore app

lRetval := await(TXDataClientResponse, MainData.WebClient.RawInvokeAsync(svc_name, [AUser]));

The object is populated and this show in the Network trace

Tracing using Wireshark shows the data in the call.

Yet when it is received in the service method, all fields are blank.

Any ideas where to start looking?

In XData, the JSON properties are the field names without the "F". So they should be "FirstName", "LastName", etc., not "FFirstName", "FLastName", etc.

So we can't use standard objects with properties then, as the passing the object to the webclient serialises the fields (FName) and the parser on the server looks for Name not FName.

So we fall into the other trap of not being able to have fields that start with 'F', like FirstName.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.