blob: 541fa8caf413538c816f034bf881157bf3cf43e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
program RPCCli;
uses SysUtils, Classes, fpAsync, xmlrpc;
type
TClientApplication = class
procedure WriteStringCompleted(AParser: TXMLRPCParser);
procedure AddCompleted(AParser: TXMLRPCParser);
public
procedure Run;
end;
procedure TClientApplication.Run;
var
Client: TXMLRPCClient;
begin
Client := TXMLRPCClient.Create(nil);
try
Client.Call(@WriteStringCompleted, 'WriteString', ['A test string']);
Client.Call(@AddCompleted, 'Add', [123, 456]);
finally
Client.Free;
end;
end;
procedure TClientApplication.WriteStringCompleted(AParser: TXMLRPCParser);
begin
WriteLn('"WriteString" call completed');
end;
procedure TClientApplication.AddCompleted(AParser: TXMLRPCParser);
begin
WriteLn('"Add" call completed. Result: ', AParser.GetNextInt);
end;
var
App: TClientApplication;
begin
App := TClientApplication.Create;
try
try
App.Run;
except
on e: Exception do
WriteLn('Error: ', e.Message);
end;
finally
App.Free;
end;
end.
|