views:

286

answers:

2

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

+2  A: 

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.

Serg
Then what I can do expose the records?, I need to expose at least 10 properties and each of them refer to record, or is there something better?
DelphiDev
I Know about that, but I need something like records because it will contain more than a value, also I have to expose more than 10 records, which make it more than 20 or 30 property for just that, which isn't suitable in my case.
DelphiDev
It is also possible to refer to the indivdual fields of a record in the read and write sections of a property declaration: `property Val1: Integer read fMyRec.Val1 write fMyRec.Val1;`
Gerry
A: 

I have tried RemObjects SDK,and it does the job.

Delphi isn't able to simple things like records inside class for web services :-(, I think they need to work real hard to make Delphi real enterprise tool.

DelphiDev
+1 ... there should be a Delphi 'Enterprise' Edition ...
mjustin