TStringList Type undefined

Hallo,
ich möchte an einen Service meines xData-Servers eine Variable vom Typ TStringList schicken. Ich habe die Unit System.Classes in den uses aufgenommen. Aber beim Kompilieren bekomme ich die Fehlermeldung:

Blockquote
Erste Gelegenheit für Exception bei $76441072. Exception-Klasse EFromURIBindingNotSupported mit Meldung 'Cannot define action "Send_VersandMail": Type "(undefined)" for param "Attchm" cannot be bound from URI'. Prozess BD_VersandServer.exe (19588)

Wird der Typ TStringList nicht supported?

unit TMailSrvcImplmnttn;

interface

uses
  XData.Server.Module,
  XData.Service.Common,
  System.Classes,
  TMailSrvc;

type
  [ServiceImplementation]
  TMyMailService = class(TInterfacedObject, IMyMailService)
  private
    function   Send_VersandMail (SenderName, SenderMail, ToMail, ccMail, bccMail,
               Betreff, JS_ArrayString: string; Attchm: TStringList): boolean;
  end;

implementation

uses TSendMail, TLogic_Procs;

{ TMyMailService }

function TMyMailService.Send_VersandMail(SenderName, SenderMail, ToMail, ccMail,
  bccMail, Betreff, JS_ArrayString: string; Attchm: TStringList): boolean;
begin

end;

initialization
  RegisterServiceType(TMyMailService);

end.

Vielen Dank
Patrick

TStrings is almost fully supported, as explained here: Service Operations | TMS XData documentation

But not as an input parameter. For that you can simply use TArray<string>.

Hi Wagner,

thanks for answering. Can you please descrip, what I have to change, because I get the same Error-Message by using TArray

Erste Gelegenheit für Exception bei $76D41072. Exception-Klasse EFromURIBindingNotSupported mit Meldung 'Cannot define action "{Attchm}": Type "(undefined)" for param "Attchm" cannot be bound from URI'. Prozess BD_VersandServer.exe (18548)

That is the code what I tried, based on the description which you linked in your answer:

type
  [ServiceContract]
  [Route('SMail')]
  IMyMailService = interface(IInvokable)
    ['{12D773D5-3B35-4A28-8237-6F5AF285C6DD}']
    // By default, any service operation responds to (is invoked by) a POST request from the client.
    [HttpGet, Route('{Attchm}')] function  Send_VersandMail (SenderName, SenderMail, ToMail, ccMail,
                        bccMail, Betreff, JS_ArrayString: string; Attchm: TArray<string>): boolean;
  end;

But to be honest, I do not really understand the different routings, which are needed.

Many thanks for support.
Patrick

The problem here is that you are defining it as GET method. Such methods can only receive parameters via URL, not via body request as JSON.

Arrays cannot be received as URL, only as JSON, thus you cannot define a GET method with a parameter that is defined as an array.

I guess your method sends an e-mail based on passed parameters, thus it's not recommended you use GET but POST for such methods. Then, you can receive all parameters via JSON, which is the recommended way.