How can I use XData Service in a WebBroker

I made a Stand Alone Server with XData and Aurelius, now I want to move the code to a WebBroker in order to run in linux.

But I do not know how.

I tried to make a linux XData Server step by Docs, but I did not find a way to run the XDdata Services on it.

Another question is can I use the XDataServer component in a linux project??I tried add the component to a WebModule, but it dose not work.

I get the way to Run XData Service on Linux.

For now my only question is can I user the XDataServer component in a Linux WebBroker project??

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:

  1. 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

  2. you need a class implementing IWebBrokerAdapter interface suitable for your web server. Sparkle provides couple of predefined implementations. Let's call this class TmyWebBrokerAdapter.

  3. from within the WebBroker Web action handler you invoke this server:

procedure TMainWebModule.blablablaAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  Adapter: IWebBrokerAdapter;
  Adapter := TmyWebBrokerAdapter.Create(Request, Response);

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.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

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):

  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