开发者

Using Records with Delphi web services

开发者 https://www.devze.com 2022-12-21 23:47 出处:网络
I\'m trying to use records with web services application in Delphi 32, the records defined as TMyRec = record

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;  

ITMySer开发者_开发知识库vice = 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号