can't find "XData.client" / can't find unit "XData.Service.Common" / can't find unit "XData.Server.Module"

Hi ANYONE / TMS TEAM

  1. I have installed xdata through tms smart installer.
  2. I created a basic server, using the wizard (including sample code), following the steps at Service Operations | TMS XData documentation
  3. changed ONE function from the sample code - 'sum' becomes 'hello' which simply returns a string saying 'hello'
  4. the server compiles and runs

Now the problem starts...

  1. i created a new client project - following the instructions in the same tutorial

  2. used the interface file from the server project

  3. the client project fails with the error message: [[Error] cnlService.pas(6): can't find unit "XData.Server.Module" (and seems to apply to all the xdata.* dcu modules)

  4. have checked in the folders and the correctly named dcus are there

  5. have added this to the project, options, delphi compiler, search path

D:\TMS Components\Products\tms.biz.xdata\packages\d12\Win32\Debug;D:\TMS Components\Products\tms.biz.xdata\packages\d12\Win32\Release;D:\TMS Components\Products\tms.biz.xdata\packages\d12\Win64\Debug;D:\TMS Components\Products\tms.biz.xdata\packages\d12\Win64\Release

  1. error persists
  2. uninstalled and reinstalled xdata with tms smart installer (will see in screenshots that dcus are dated today)
  3. error persists
  4. deleted _history folder and _recovery folder
  5. error persists
  6. code is very basic:

unit cnlService;

interface

uses

  • XData.Server.Module*
    , XData.Service.Common;

type

  • [ServiceContract]*
  • IcnlService = interface(IInvokable)*
  • ['{3051CF75-E3A6-404F-A8A6-8F8D814281A1}']*
  • [HttpGet] function Hello: String;*
  • // By default, any service operation responds to (is invoked by) a POST request from the client.*
  • function EchoString(Value: string): string;*
  • end;*

implementation

initialization

  • RegisterServiceType(TypeInfo(IcnlService));*

end.

  1. folder screenshots


  1. complete project

cnl.zip (215.1 KB)

What should be a simple learning exercise following your tutorials and documentation has turned into hours of wasted time, head-bashing, trying to figure out an error that should not be possible.

PLEASE can someone help!!!!
C

PS - this seems to be only this level of xdata dcus - i have written a sample with a sqlite database and a client accessing that database as per video "From Database to Web App through REST server with TMS XData and TMS Web Core". that does not directly use xdata.* dcus and compiles and runs perfectly.

forgot to add client code:

unit ufrmmain;

interface

uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils, VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes,
Vcl.StdCtrls, WEBLib.StdCtrls, Vcl.Controls, VCL.TMSFNCCustomControl, VCL.TMSFNCWebBrowser,
VCL.TMSFNCCustomWEBControl, VCL.TMSFNCMemo, cnlService, XData.Client;

type
TForm1 = class(TWebForm)
mmo: TTMSFNCMemo;
btnHello: TWebButton;
procedure btnHelloClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
var
Client: TXDataClient;
cnl: IcnlService;

implementation

{$R *.dfm}

procedure TForm1.btnHelloClick(Sender: TObject);
begin
mmo.lines.add (cnl.hello);
end;

procedure TForm1.WebFormCreate(Sender: TObject);
begin
Client := TXDataClient.Create;
Client.Uri := 'https://ittutorsa.co.za:443/cnl';
cnl := Client.Service;
end;

end.

this errors on xdata.client if i move cnlservice after xdata.client. as is errors out on XData.Server.Module

server is live

NB: the server uses the exam same code as in the first post and compiles without an issue.

server code included in zip.

implementation (listed below) also compiles without error

HOW IS THIS POSSIBLE?

unit cnlServiceImplementation;

interface

uses
XData.Server.Module,
XData.Service.Common,
cnlService;

type
[ServiceImplementation]
TcnlService = class(TInterfacedObject, IcnlService)
private
function Hello:String;
function EchoString(Value: string): string;
end;

implementation

function TcnlService.Hello:String;
begin
Result := 'Hello';
end;

function TcnlService.EchoString(Value: string): string;
begin
Result := Value;
end;

initialization
RegisterServiceType(TcnlService);

end.

You forgot to mention one tiny information: your client application is a TMS Web Core application. That's a totally different beast than a regular Delphi application.

A TMS Web Core application doesn't support many things, like direct access database, FireDAC, Aurelius, XData server components (you shouldn't need to use XData.Server.Module in your data contract interface unit), and so on.

Using XData (and any other RESP API server) is different from TMS Web Core applications, and in this specific chapter we explain how to do it from Web Core:

thank you - will read article - sorry for being such a n00b