You are not logged in.
Pages: 1
I found that I used sample06 client to build a tsqlmodel
What is the use of TSQLmodel?
Offline
I would like to send the TSQLrecord object to restful server how do i do?
Offline
I tried this code Fclient.CallBackGetResult ('UserLogin', [UserInfo]);
but httpserver recive nil ctxt.parmaters
procedure THttpServer.UserLogin (CTXt: TSQLRestServerURIContext);
var
User: TUserInfo;
P: PUTF8Char;
begin
//
//
P: = CTXt.Parameters;
end
Offline
My ServerCode
unit frm_Server;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,SynCommons,mORMot,mORMotHttpServer,data_record,
Vcl.StdCtrls;
type
THttpServer=class(TSQLRestServerFullMemory)
published
procedure UserLogin(CTXt:TSQLRestServerURIContext);
end;
TForm1 = class(TForm)
Button1: TButton;
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FModel: TSQLModel;
{ Private declarations }
FServer:THttpServer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormDestroy(Sender: TObject);
begin
if Assigned(FServer) then FreeAndNil(FServer);
if Assigned(FModel) then FreeAndNil(FModel);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
button1.Enabled :=false;
if Assigned(FServer) then FreeAndNil(FServer);
if Assigned(FModel) then FreeAndNil(FModel);
FModel :=TSQLModel.Create([TUserInfo],'service');
FServer :=THttpServer.Create(FModel);
FServer.ExportServerNamedPipe('RestService');
Button1.Enabled :=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
{ THttpServer }
procedure THttpServer.UserLogin(CTXt:TSQLRestServerURIContext);
var
User:TUserInfo;
P:PUTF8Char;
begin
//
//
P :=CTXt.Parameters;
end;
end.
Offline
My ClientCode
procedure TestRestfullHttpClient.SetUp;
begin
inherited;
FModel :=TSQLModel.Create([TUserInfo],'service');
FClient :=TSQLRestClientURINamedPipe.Create(FModel,'RestService');
end;
procedure TestRestfullHttpClient.TearDown;
begin
FreeAndNil(FClient);
inherited;
end;
procedure TestRestfullHttpClient.TestRestuFullClientAccess;
var
UserInfo :TUserInfo;
begin
UserInfo :=TUserInfo.Create;
try
UserInfo.UserName :='EricWang';
UserInfo.Password :='123456';
UserInfo.SessionKey :='sldkjfa;lkdjf';
UserInfo.Version :='1.125';
UserInfo.ProductID :=3;
Fclient.CallBackGetResult('UserLogin',[UserInfo]);
finally
FreeAndNil(UserInfo);
end;
Offline
Please follow the forum rules.
https://synopse.info/forum/misc.php?action=rules
Don't post such extensive source code in the forum.
About your question, it is unclear what it is.
Open the documentation https://synopse.info/files/html/Synopse … 01.18.html
Go to the keyword list. Search for TSQLModel.
Click on the light blue links, which are the "main entries" about the keyword.
You will find https://synopse.info/files/html/Synopse … l#MNDX_666
and https://synopse.info/files/html/Synopse … #MNDX_2059
Online
Pages: 1