I'm sorry, the code works fine. Actually, I had to fix your code as it has being instead of begin, and the declaration type of Response parameter of OnError procedure is wrong (it should be TXDataClientError, not TXDataClientResposne, according to the documentation).
After I fixed the errors in your code, it compiles fine. This is the tested code:
procedure TForm1.Execute;
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('IMyService.InfoVersion', []));
end;
procedure TForm1.WebButton1Click(Sender: TObject);
procedure OnResult(Response: TXDataClientResponse);
begin
end;
procedure OnError(Response: TXDataClientError);
begin
end;
begin
XDataWebClient1.RawInvoke('IMyService.InfoVersion', [], @OnResult,@OnError);
end;
That's not a syntax error. That's how async/await should work with Web Core/Pas2Js. If you are using await in a procedure, such procedure (Execute, in this case), should have the async directive. That's exactly what the error message says.