unit ClientForm;
interface
uses
  SysUtils, Types, UITypes, Classes, Variants, FMX_Types, FMX_Controls, FMX_Forms,
  FMX_Dialogs, FMX_Layouts, FMX_ListBox;

type
  TDataSnapClientForm = class(TForm)
    ListBox1: TListBox;
    btnConnect: TButton;
    procedure btnConnectClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DataSnapClientForm: TDataSnapClientForm;

implementation
uses
  DSRESTConnection, DSProxy, DB;

{$R *.lfm}

procedure TDataSnapClientForm.btnConnectClick(Sender: TObject);
var
  Server: TDSRestConnection;
  Proxy: TMyServerMethods; // name at server
  DataSet: TDataSet;

begin
  Server := TDSRestConnection.Create(nil);
  try
    Server.Host := 'www.bobswart.nl';
    Server.Port := 443;
    Server.UrlPath := '/DataSnapXE2/DataSnapServerRESTISAPI.dll';
    Server.Protocol := 'https';
    Server.UserName := 'Bob';
    Server.Password := 'Swart';

    Proxy := TMyServerMethods.Create(Server);
    if Assigned(Proxy) then
    try
      ListBox1.Items.Add(DateTimeToStr(Proxy.ServerTime));
      ListBox1.Items.Add('---');
      DataSet := Proxy.GetEmployees;
      if Assigned(DataSet) then DataSet.Open;
      while not DataSet.Eof do
      try
        ListBox1.Items.Add(
          DataSet.FieldByName('FIRST_NAME').AsString + #32 +
          DataSet.FieldByName('LAST_NAME').AsString);
      finally
        DataSet.Next
      end;
    finally
      Proxy.Free
    end;
  finally
    Server.Free
  end;
end;

end.
