TXDataClientResponse Problem with TWebdatamodule

I'm using rawinvokeasync with xdatawebclient to return a json result without any problem in my Delphi unit. I want to move these calls to a datamodule for conciseness and coding efficiency. However, I get the following compiler error in the TWebdatamodule with this code on the assignment to Response
function TdmFinale.LoadTableData(QID:integer) : boolean;
var
Response: TXDataClientResponse;
begin
result := true;
retdata := '';
try
case QID of
1 : Response := await(XDataWebClient1.RawInvokeAsync('IFinDataService.GetVPtns', []));
2 : Response := await(XDataWebClient1.RawInvokeAsync('IFinDataService.GetProvList', []));
end;
.....
end;
......
except on E:Exception do
begin
result := false;
end
end;
end;
Error= E2010: Incompatible types: TXDataClientResponse and TJSValue

I'm using XData 5.11

It must be something in the order of units in your uses clause.
What is the exact line that causes the error, and what do you have in your uses clauses?
Strange that it mentions TJSValue, not JSValue, which is the correct type name.

I use this approach

Response := TAwait.Exec<TXDataClientResponse>( XDataWebClient.RawInvokeAsync( ...

So I can specify the type.
But with that there could be further problems with JSValue vs TJSValue. There are small incompatibilities with it.

interesting..using Kaeswurm's approach it compiles. I'll test later to ensure it runs correctly. Here is the order of the uses in my data module. I did try moving things around but same error.
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Modules, XData.Web.Client,
XData.Web.Connection;

thanks

1 Like