[DUG] Extracting Web Service data from a TRemotable

Edward Koryagin ed_iv2001 at yahoo.co.nz
Sun Apr 26 18:13:29 NZST 2009


record_array[0].UniqueId;

Edward Koryagin


--- On Sat, 25/4/09, Mark Williamson at Warkworth Computer Services Limited <wcsl at kol.co.nz> wrote:

> From: Mark Williamson at Warkworth Computer Services Limited <wcsl at kol.co.nz>
> Subject: [DUG] Extracting Web Service data from a TRemotable
> To: delphi at delphi.org.nz
> Received: Saturday, 25 April, 2009, 11:19 AM
> 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: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz
> with Subject: unsubscribe


      Get the world&#39;s best email - http://nz.mail.yahoo.com/



More information about the Delphi mailing list