Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Records with Delphi web services

I'm trying to use records with web services application in Delphi 32, the records defined as

TMyRec = record
  Val1:integer;
  Val2:string;
end;

TMyClass = class(TRemotable)
  private fMyRec:TMyRec;
published
  property MyRec:TMyRec read fMyRec write fMyRec;
end;  

ITMyService = interface(IInvokable)
  ['{6283B8DA-C567-4814-906E-321729B1AE72}']

    function GetMyClass(id:Integer):TMyClass;stdcall;
  end;

but it doesn't exposed as on WSDL file, so is there problem when using records?

I'm using Delphi 2009

like image 315
DelphiDev Avatar asked Nov 19 '25 00:11

DelphiDev


1 Answers

Even if the compiler does not prohibit to publish the record data types, it does not provide the full support for it - see docwiki


Updated:

You can always publish the separate fields instead of the whole record:

TMyRec = record
  Val1:integer;
  Val2:string;
end;

TMyClass = class(TRemotable)
  private fMyRec:TMyRec;
published
  property MyRecVal1:Integer read GetMyRecVal1 write SetMyRecVal1;
  property MyRecVal1:string read GetMyRecVal2 write SetMyRecVal2;
end;  

You must implement simple getter and setter methods to access fMyRec fields. I hope that helps, though I am not sure that is what you are looking for.

like image 129
kludg Avatar answered Nov 20 '25 15:11

kludg