Can I use TXDataClient component in Web Core Application? If yes, how or any sample would be helpful.

Hi Team,

Can I use TXDataClient component in Web Core Application to call web service methods like follow.

var

  • client1: TXDataClient;*
    begin
  • client1 := TXDataClient.Create;*
  • client1.Uri := 'http://localhost:2001/tms/api/v1/auth/login';*
  • JWT_Token_Rec := client1.Service<iloginService>.Login(edtUserName.Text, edtpassword.Text);*
  • client1.Free;*
  • WebMemo1.Lines.Text := JWT_Token_Rec;*

If I do like this, I get following error.
[Error] loginService.pas(6): can't find unit "XData.Service.Common"

If I add the path, in TMS WEB option then it shows other errors.

I'm sure you've seen this:

Are you accessing Service properly?

What that doc shows is you want is something like Service<IMyService>

Otherwise, you're assuming that Login is a class method of Service that applies to ALL services.

FYI: your code would make more sense if you highlighted it and then clicked the </> thing in the edit menu area.

yes. I used the services correctly. Tms html editor was not show <> tags.
I am using as follow.

JWT_Token_Rec := client1.Service<iloginService>.Login(edtUserName.Text, edtpassword.Text);

XDatclient works fine with desktop app. but when I use in webcore it shows compile error.
can't find unit "XData.Service.Common"

TXDataClient is only supported in "regular" Delphi platforms (Windows, Linux and mobile).
To use it from TMS Web Core, there are specific classes (TXDataWebClient), componentes and paradigm:

For WebCore you need to use the TXDataWeb.. components

Thank you

That has tripped me up before ... missing the 'Web' part in the calls. I guess it's why I look for code that's working and then do a copy-and-paste (much as I despise that approach).