Cannot define action "CallPPSServiceMethod": Invalid type "TValue" for param "AArgs"

Hi,

Strange situation, I have a service method like this

function CallPPSServiceMethod(AMethodName: String; const AArgs: array of TValue; launcher:string): string;

In uses in interface and interface implementation I have System.Rtti, compilation is ok but when the XData starting i have an error like this:

Cannot define action "CallPPSServiceMethod": Invalid type "TValue" for param "AArgs"

What is wrong, I can't use the TValue type inside the XData Rests?

Regards.

Correct, TValue is not a supported type for XData service operations.

Ok ... but what about this.

I changed the type in the service method:
function CallPPSServiceMethod(AMethodName: String; const AArgs: array of string; launcher:string): string;

but when I call from webapp the method from TXDataWebClient like this:

const par: array of string = ['aaa'];
begin
 
  Await(dmWebModule.xdataclntWebClient.RawInvokeAsync('IWEBService.CallPPSServiceMethod',['GetRecipients',par,'test']));

end;

I got an error:

Invalid string JSON value at $.AArgs

Can you please:

  1. Try using TArray<string> instead of array of string.
  2. Post the exact JSON that the Web Core app is sending to the server (you can check it in the network tab of your browser developer tool tab).

Yes sure no problem:

  1. Now is ok when I changed type from array of string to TArray<string> on the both side XData service and invoke from the web client.

  2. Json from dev tools network tab when I'm using array of string is:
    {"AMethodName":"GetRecipients","AArgs":["aaa"],"launcher":"test"}
    After send I get http status code 400 (Bad request)

For me it is rather problem from XDATA service param deserialization from JSON, the posted json looks good.

Ok, I assume this is solved then? You should indeed use the TArray<T> type.

Yes is solved when you use TArray.

Thx for help.

1 Like

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