Delphi で DataSnap のときの個人的メモ

とりあえずの個人的メモです。

サーバーの作成

ファイル→新規→その他
Delphiプロジェクト→DataSnap Server→DataSnap REST アプリケーション
スタンドアロン アプリケーション
VCL アプリケーション

ServerMethodUnit1.pas

function MyMethod(Value: string): string;
Ctrl+Shift+C
あとは実装

クライアントの作成

モバイルアプリ新規作成

DataSnap REST クライアント モジュール
リモート サーバー
IPアドレス入力+接続テスト

uses ClientModuleUnit1 を追加

var
  wrk: string;
begin
  wrk := ClientModule1.ServerMethods1Client.MyMethod('あいう');
  ShowMessage(wrk);
end;
Delphi ファイル→データモジュール
他から呼び出し