XDataWebClient RawInvokeAsync with Query

Hello Wagner,

2 questions.

The REST call (is a service function)
http://myServer:myPort/k/func/Search?$expand=Person/PersonAdresseList&$select=KundeID,Code,Person/Nummer,Person/Vorname,Person/Nachname&$top=10
works in Postman REST Client. ($expand and $select)

But

  1. Only the $top=10 Statement doesn't work
  2. Can I use a QueryString in my WebcoreApp with RawInvokeAsync? (see example)
  q := '$expand=Person/PersonAdresseList&$select=KundeID,Stammfiliale,Code,Klasse,Person/Nummer,Person/Vorname,Person/Nachname,'+
       'Person/Geburtsdatum,Person/Firma,Person/Firmenname,Person/PersonAdresseList/Strasse,Person/PersonAdresseList/Hausnummer,'+
       'Person/PersonAdresseList/PLZ,Person/PersonAdresseList/Ort,Person/PersonAdresseList/Land&$top=20';
  try
    Response := TAwait.Exec<TXDataClientResponse>( XDataWebClient.RawInvokeAsync( 'IsngKunde.Search', [ MakeSngParameter( '', '10000', JSPara)], q));
    if Response.StatusCode = _http_200_Ok then

This is just a snippet.
The RawInvokeAsync call does not allow a "Query" parameter.

Thomas

The "MakeSngParameter" makes only the parameter (JSON-String) for the function call. I would like to send the "q" (Querystring)

I wanted to try switching to RawInvoke but in VisualStudioCode the procedure RawInvoke does not accept the q parameter.

I want use VSC, because of debugging.

    procedure RawInvoke(const OperationId: string; Args: array of JSValue; const Query: string; SuccessProc: TXDataClientLoadProc; ErrorProc: TXDataClientErrorProc = nil); overload;
    procedure RawInvoke(const OperationId: string; Args: array of JSValue; const RequestId: string = ''); overload;
    procedure RawInvoke(const OperationId: string; Args: array of JSValue; SuccessProc: TXDataClientLoadProc; ErrorProc: TXDataClientErrorProc = nil); overload;

The first one doesn't exists in VSC

I think, I have a temporary solution.
In Event XDataWebConnection On Request I add the QueryString.

procedure TMyDataModule.XDataWebConnectionRequest(Args: TXDataWebConnectionRequest);
begin

  Args.Request.Uri := Args.Request.Uri + FQueryString;

Is that a reasonable solution?
So I can use RawInvokeAsync again

Hi @Kaeswurm_Thomas,

This has been fixed internally and next version release will include the fix.

Yes, you can simply use the overloaded version you mentioned, the one that receives a Query as parameter. The source code for VSC is exactly the same as for Delphi, you should have the same methods. Are you sure you are using the same versions for VSC and Delphi?

In any case, your workaround is fine as well.

There is no function (RawInvokeAsync(!)) with a "QueryString" parameter. Only with RawInvoke.

That is true, but you mentioned that the RawInvoke version with the Query parameter doesn't exist in VSC. So I'm not sure what problem we are trying to solve here? Are the RawInvoke functions correct in both VSC and Delphi?

Yes, but since I have a solution using RawInvokeAsync, I won't use RawInvoke in this case.
For me there are some differences between Delphi IDE and VSC, and also within the IDE with the different compilers. But I'm still too inexperienced with Web Core development. But it's getting better every day.
For now it's ok for me.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.