How to capture HTML form data POST with a XData software server

I successfully created a XData server in Delphi and now I want to send POST data from an HTML form to it and show the results in a memo field. I will be putting this software on a computer with a static IP. Assuming the static IP is for ease of explanation, what XData server commands would I use to make this happen?

Thank you.


When I run the XData server, the following shows in the browse at http://localhost:2001/tms/xdata:

{ "value": [] }

What is this showing and from where? Is it a POST or GET? It just seems like a blank piece of code. The XData server has two units, server1 and server2. Nowhere in these units is this code found.

Is the following code responsible:

procedure TMainForm.UpdateGUI; const cHttp = 'http://+'; cHttpLocalhost = 'http://localhost'; begin btStart.Enabled := not ServerContainer.SparkleHttpSysDispatcher.Active; btStop.Enabled := not btStart.Enabled; if ServerContainer.SparkleHttpSysDispatcher.Active then mmInfo.Lines.Add(SServerStartedAt + StringReplace( ServerContainer.XDataServer.BaseUrl, cHttp, cHttpLocalhost, [rfIgnoreCase])) else mmInfo.Lines.Add(SServerStopped); end;

Specifically, is this code responsible for the result in localhost?

ServerContainer.XDataServer.BaseUrl, cHttp, cHttpLocalhost, [rfIgnoreCase]))

I am trying to understand what is going on under the hood.

I just noticed that much of this is at design time through the visual modules.
Using the Http.Sys config tool, I was able to change the server URL to something more custom, so that is good.

Which dispatcher should I use to capture incoming POST data?


The static IP used to reach your XData server doesn't matter for XData itself. Your server will be reached and will respond accordingly no matter in what IP it's running.

This is a legacy, convention endpoint from XData, at the root endpoint of the server it lists all the entities published via its endpoints. In this case there is none. You can ignore that.

Your code is not well formatted so it's really hard to read it, but it doesn't relate to the root endpoint, since it's automatic.

To receive an arbitrary POST request that is not receiving a JSON, you can create a service operation receiving a TStream object: