Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

ThXmlRpc

Basic Server for Web Service on the XML-RPC protocol.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

ThXmlRpc 0.1

============== Basic Server for Web Service on the XML-RPC protocol.

Implemented in Free Pascal. Only has support for the types: int, double, Boolean, and string. No structured data types are supported.

To implement a XML-RPC server, only it's needed to include the unit ThXmlRpc.

Sample code:

pascal
program server;
{$mode objfpc}{$H+}
uses
  SysUtils, ThXmlRpc;

procedure Hello(params: TthXmlRpcParams; response: TthXmlRpcResult);
begin
  if (params.Count<>1) or (params[0].rpcTyp<>xmlRpcString) then
  begin
    writeln('Parameters error.');
    exit;
  end;
  response.valStr := 'Hi ' + params[0].valStr + '!';
end;

var
  Serv: TthXmlRpcServer;

begin
  RegisterFunction('Hello', @Hello);
  writeln('Listening...');
  Serv := TthXmlRpcServer.Create(nil);
  try
    Serv.Port:=1234;
    Serv.Active:=true;
  finally
    Serv.Free;
  end;
  ReadLn;
end.