Using WebCore with XData

I tried to compile a barebone REST-client I have for Web Core. The program works with an XData-server.
After succesfull compiling in Delphi the JS compiler complains:
[Error] UnClientConnectieINT.pas(38): can't find unit "XData.Client"

I use the latest versions of all components. Doesn't it work with the regular version of XData yet? Do I need the special version mentioned in the readme? I that case I'll wait a little longer until the regular version is ok to use, because I don't want to get involved with two different versions of XData.

The latest version of TMS XData should be sufficient.

Can you verify the library path passed to the pas2js compiler that it includes the folder where TMS XData is installed? You can see all command-line arguments for pas2js in the IDE console.
I see that these are in the path and correct:

C:\Programmeren\tmssoftware\TMS XData\source\core\common;
C:\Programmeren\tmssoftware\TMS XData\source\core\web;
But the XData.Client is in

c:\Programmeren\tmssoftware\TMS XData\source\core

Which is NOT in the call of the pas2js compiler.

Please try to add this path via : Tools, Options, TMS Web, Library Path

That brings me one step further.
Now it complains about generics.collections, which is part of Delphi. But I don't see any part of Delphi in the list of directories that is supplied to pas2js. Only TMS libraries.

The installation was correct. Please revert what you've done. You should not add 

"c:\Programmeren\tmssoftware\TMS XData\source\core"
to TMS Web library path. That folder contains source code that is "Delphi" (not Web) specific.
TXDataClient cannot be used from TMS Web. You should use TXDataWebClient instead.


Wagner R. Landgraf2018-05-31 15:22:27
I see.
I am trying to use as much code as possible from my standard units, so is it possible to define for a conditional compile?
I tried a standard $DEFINE in the main unit of the client, but that doesn't work.

What you would like to use a conditional define for? What exactly did you try with $DEFINE?

With TMS Web Core, you must use a different client class, named TXDataWebClient. They are different controls, different way of use. TXDataWebClient is asynchronous, it does not have a generic version, etc., so they are quite different.
Hm, I was hoping to reuse some Interface/Implementation units I use to connect the client, init logging, init database connection etc.
But if that is not possible I'll put it on hold until the offical version with documentation etc. arrives before starting a rewrite.

fwiw, you can use the conditional define {$IFDEF WIN32} for when you compile code for a windows target and {$IFDEF PAS2JS} for code for the web client only

1 Like
I tried that and it helps. For now. The units compile without an error.
I now get a compilation error in an XData unit??

  [Error] XData.Web.Connection.pas(36): There is no method in an ancestor class to be overridden "procedure EndUpdate of Object"

Have you cleaned up the changes you've done in the library path mentioned above?

Are you using the very latest version of TMS Web Core? 
What is your currently TMS Web Core settings regarding library path?
I have cleaned it up and I'm using the latest version.
I have decided to put this project on hold for some time, until Web Core has matured and there is some documentation. It's promising, but not usable in a real project for now. Most of the time I am totally in the dark about what to do, when it comes to something outside the supplied examples. If I am going to use it, it has to fit into my main project somehow and that is totally not the case for now.
Thanks for your attention.

It would be helpful to know what exactly you struggled with other than the TMS XData setup?

Learning this will help us improve the product and its documentation.

I get that.
What I try to do is this:
I have a win32 XData
clientprogram in which the userinterface and the connection with the
XData server are strictly separated. In an ideal world I would only have
to write a new user-interface in WebCore and re-use the units that
connect to XData.
The Connection is made with an XDataclient. As you
suggested I introduced conditional compiling with IFDEFs to use an
XDataclient or an XDataWebClient to make the connection.
The compiler did not give me errors on the clients anymore, but now I get this:
[Error] XData.Web.Connection.pas(36): There is no method in an ancestor class to be overridden "procedure EndUpdate of Object"
which I can't resolve. So I'm stuck.
I
was hoping to move forward step by step and when things simply would
not work, I would take them out. But I can't resolve an error like this,
because I don't know what to look for.

Ronald, could you please provide the values you have in "Library Path" option for TMS Web?

That would be under Tools, Options, TMS Web, Library Path.
Wagner, I have nothing in there. It's empty.
The rest of the parameters seem pretty standard.

Ronald, could you please search in your entire disk for file named Classes.pas?

There should be the ones from Delphi, but also from TMS Web Core. Could you please then send me the Classes.pas file you found in the e-mail, mentioning the folders you found them? Thank you very much in advance.

I sent you an E-mail.

Hello Ronald,

The Classes.pas you have for TMS Web Core is not the latest one. That's why you get compilation errors when using TMS XData. I know that you stated you have installed latest version of TMS Web Core, but something is not right. I would suggest you uninstall it, download the very latest version and install it again.