Show/Hide Toolbars

TMS XData Documentation

Navigation: Basic XData Programming

Creating an XData Server

Scroll Prev Top Next More

TMS XData Server is based on the TMS Sparkle framework. The actual XData Server is a Sparkle server module that you add to a Sparkle HTTP Server.

 

Please refer to the following topics to learn more about TMS Sparkle servers:

 

Overview of TMS Sparkle HTTP Server

Creating an HTTP Server to listen for requests

TMS Sparkle Server Modules

 

To create the XData Server, just create and add a XData Server Module (TXDataServerModule class, declared in unit XData.Server.Module) to the Sparkle HTTP Server. The following code illustrates how to create and run the server. Note that the code that creates the XData server module is not displayed here. You should refer to the "XData Server Module" topic to learn about how to create the module:

 

uses
  {...}
  Sparkle.HttpSys.Server, XData.Server.Module;
 
function CreateXDataServerModule(const BaseUrl: string): TXDataServerModule;
begin
  // Create and return the TXDataServerModule here,
  // using the BaseUrl as the server address
end;
 
var
  Module: TXDataServerModule;
  Server: THttpSysServer;
begin
  Server := THttpSysServer.Create;
  Module := CreateXDataServerModule('http://server:2001/tms/xdata');
  Server.AddModule(Module);
  Server.Start;
  ReadLn;
  Server.Stop;
  Server.Free;
end;

 

The code above will create and start an XData server that will receive and respond to HTTP requests at the address "http://server:2001/tms/xdata".