Not sure whether this applies to Linux as well, but I have ISAPI module running under IIS (Windows) where XData functionality is exposed through WebBroker framework:
you need an instance of Sparkle TWebBrokerServer that has been properly initialized and has a TXDataServerModule added to it's Dispatcher. Let's call the variable holding this instance gXDataServer
you need a class implementing IWebBrokerAdapter interface suitable for your web server. Sparkle provides couple of predefined implementations. Let's call this class TmyWebBrokerAdapter.
from within the WebBroker Web action handler you invoke this server:
procedure TMainWebModule.blablablaAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
Var
Adapter: IWebBrokerAdapter;
begin
Adapter := TmyWebBrokerAdapter.Create(Request, Response);
gXDataServer.DispatchRequest(Adapter);
end;
Thank u @Roman_Krejci , I got the same way to yours, but I also want to know if the XDataServer design-time component can be used in a WebBroker project and how, just out of interest.
You can use it, but since currently there is no design-time equivalent of TWebBrowerServer, the benefits are not that many, as you still have to create it from code.
But in any case you want to know how, the step 4 of the Apache-based server documentation will look like the following (assuming you created MyXDataServer1 somehow, say it's in a data module or something like that):
initialization
Server := TWebBrokerServer.Create;
// add modules you want to use. This example assumes a simple Sparkle module,
// but you can add your XData, RemoteDB or any other Sparkle module
Server.Dispatcher.AddModule(MyXDataServer1.CreateModule);
finalization
Server.Free;
end.