web servis Tstrings veya Tstringlist nasıl kullaılıyor.

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
igny
Üye
Mesajlar: 54
Kayıt: 14 Mar 2008 04:03

web servis Tstrings veya Tstringlist nasıl kullaılıyor.

Mesaj gönderen igny »

merhaba arkadaşlar bir web servisi yazmak istiyorum.web servisi veritabanına bağlanacak çeşitli şartlara göre sırala çağırdığım verileri stringliste alıp clienta göndermesini istiyorum.Bunun için tstrings tanımladım web servisinde fakat clientta bi türlü çalıştıramadım.clientta listbox1.items a atmaya çalışıyorum ama olmuyor.yadımlarınızı bekliyorum

ŞÖYLE BİEY YAPTIM


unit IGNYIntf;

interface

uses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns,System.Classes;

type

TEnumTest = (etNone, etAFew, etSome, etAlot);

TDoubleArray = array of Double;
TStrList = TStrings; //--------BUNU TANIMLADIM
TMyEmployee = class(TRemotable)
private
FLastName: AnsiString;
FFirstName: AnsiString;
FSalary: Double;
published
property LastName: AnsiString read FLastName write FLastName;
property FirstName: AnsiString read FFirstName write FFirstName;
property Salary: Double read FSalary write FSalary;
end;

{ Invokable interfaces must derive from IInvokable }
IIGNY = interface(IInvokable)
['{71CBC87E-E3EA-4124-99E0-CD1C393BDA90}']

{ Methods of Invokable interface must not use the default }
{ calling convention; stdcall is recommended }
function echoEnum(const Value: TEnumTest): TEnumTest; stdcall;
function echoDoubleArray(const Value: TDoubleArray): TDoubleArray; stdcall;
function echoMyEmployee(const Value: TMyEmployee): TMyEmployee; stdcall;
function echoDouble(const Value: Double): Double; stdcall;
function echoSTR: TStrList; stdcall;

end;

implementation

initialization
{ Invokable interfaces must be registered }
InvRegistry.RegisterInterface(TypeInfo(IIGNY));

end.


//////////////////////////////////////////////////////

unit IGNYImpl;

interface

uses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns, IGNYIntf,sysutils;

type

{ TIGNY }
TIGNY = class(TInvokableClass, IIGNY)
public
function echoSTR: TStrList; stdcall;
end;

implementation

function TIGNY.echoEnum(const Value: TEnumTest): TEnumTest; stdcall;
begin
{ TODO : Implement method echoEnum }
Result := Value;
end;

function TIGNY.echostr: TStrList; stdcall;
var
I:Integer;
begin
{ TODO : Implement method echoEnum }
for I := 0 to 10 do
begin
Result.Add(inttostr(I));
end;

end;
Kullanıcı avatarı
SimaWB
Üye
Mesajlar: 1316
Kayıt: 07 May 2009 10:42
Konum: İstanbul
İletişim:

Re: web servis Tstrings veya Tstringlist nasıl kullaılıyor.

Mesaj gönderen SimaWB »

Bilmiyorum bu problemin çözümü olur mu ama daha mantıklı geldi bana:
Lokal bir TStringList tanımlayıp bunun üzerinde işlem yapın, en sonunda sonucu bu lokal değişkene atayın.

Kod: Tümünü seç

function TIGNY.echostr: TStrList; stdcall;
var
  I:Integer;
  rsp: TStringList;
begin
  rsp := TStringList.Create;
  try
    for I := 0 to 10 do
      rsp.Add(inttostr(I));
    Result := rsp;
  finally 
    rsp.free;
  end;
end;
There's no place like 127.0.0.1
Kullanıcı avatarı
igny
Üye
Mesajlar: 54
Kayıt: 14 Mar 2008 04:03

Re: web servis Tstrings veya Tstringlist nasıl kullaılıyor.

Mesaj gönderen igny »

web servis tarafında bir sıkıntı yok sorun client tarafında echostrden dönen stringlisti clientta almaya calıştığımda tstringlist _Igny stringlist hatası veriyor
Cevapla