Mark, I'm not sure that I understand what the code is supposed to do, but I can't see anything (at first glance) that tells me the number of elements in the returned array.
unique_id := record_array.UniqueId[1]; would normally refer to the second element in the array. Are there 2? If not, that could be the cause of the AV. Trevor _____ From: [email protected] [mailto:[email protected]] On Behalf Of Mark Williamson at Warkworth Computer Services Limited Sent: Saturday, 25 April 2009 11:19 a.m. To: [email protected] Subject: [DUG] Extracting Web Service data from a TRemotable Hi, This is my first question to the Digest, so I hope this is right way of submitting it. I am trying to consume a Web Service. Have got it working ok for simple returns of XML strings, but am completely stuck on how to handle the return of multiple records in a TRemotable Object. Here's the code that I think relates to it: GetLatestTransactionsResult = class(TRemotable) private FUniqueId:String; FPeopleId:String; FSiteLoginId:string; FSiteLogoutId:string; FErrorCode:integer; published Property UniqueId: string read FUniqueId write FUniqueId; Property PeopleId: string read FPeopleId write FPeopleId; Property SiteLoginId: string read FSiteLoginId write FSiteLoginId; Property SiteLogoutId: string read FSiteLogoutId write FSiteLogoutId; Property ErrorCode: integer read FErrorCode write FErrorCode; end; TFieldInfoArray = array of GetLatestTransactionsResult; DataPortalExSoap = interface(IInvokable) ['{94DBE733-A57C-9EBF-B5CD-167163F4ECAF}'] function GetLatestTransactionsEx(const ID: string; const Password: string; const ExternalRef: string; const FindByBatchNo: string; const FindByExternalRef: string): string; stdcall; end; initialization RemClassRegistry.RegisterXSClass(GetLatestTransactionsResult, 'http://www.ezitracker.com/eziTrackerData/', 'GetLatestTransactionsResult'); RemClassRegistry.RegisterXSClass(GetLatestTransactionsResult, '', 'TFieldInfo', ''); RemTypeRegistry.RegisterXSInfo(TypeInfo(TFieldInfoArray), '', 'TFieldInfoArray'); finalization RemClassRegistry.UnRegisterXSClass(GetLatestTransactionsResult); RemTypeRegistry.UnRegisterXSInfo(TypeInfo(TFieldInfoArray)); and then on the Form with my test buttons: procedure TFormMainForm.ButtonGetLatestTransactionsClick(Sender: TObject); var id:string; password:string; nonnullresponse:boolean; record_array:GetLatestTransactionsResult; unique_id:string; begin id := 'aaa'; password := 'bbb'; nonnullresponse := True; record_array := GetDataPortalExSoap.GetLatestTransactions(id, password, nonnullresponse); end; It appears to run ok, but I have no idea how to extract the data from record_array. If I try something as simple as: unique_id := record_array.UniqueId[1]; I get an EAccessViolation. Can anyone help please. I can't seem to find any ideas on the Web, probably because the answer it too obvious. Thanks Mark
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
