|
unit XMLWebOrnek;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Service1, InvokeRegistry, Rio, SOAPHTTPClient, ComCtrls,
AppEvnts;
type
TanaForm = class(TForm)
Label1: TLabel;
editdosyaAdi: TEdit;
Label2: TLabel;
editMetin: TEdit;
btnUzantiBul: TButton;
btnTerstenYaz: TButton;
HTTPRIO1: THTTPRIO;
istekMemo: TMemo;
cevapMemo: TMemo;
ProgressBarGonderilen: TProgressBar;
Label3: TLabel;
Label4: TLabel;
ProgressBarOkunan: TProgressBar;
procedure btnUzantiBulClick(Sender: TObject);
procedure HTTPRIO1BeforeExecute(const MethodName: String;
var SOAPRequest: WideString);
procedure HTTPRIO1HTTPWebNode1ReceivingData(Read, Total: Integer);
procedure HTTPRIO1HTTPWebNode1PostingData(Sent, Total: Integer);
procedure btnTerstenYazClick(Sender: TObject);
procedure HTTPRIO1AfterExecute(const MethodName: String;
SOAPResponse: TStream);
private
{ Private declarations }
public
{ Public declarations }
end;
var
anaForm: TanaForm;
webHizmeti:Service1Soap; // Tanimlayin
implementation
{$R *.dfm}
// Uzantil bul dügmesi
procedure TanaForm.btnUzantiBulClick(Sender: TObject);
begin
Application.ProcessMessages; // kilitlenmeyi önle
HTTPRIO1.URL:='http://localhost:2210/Service1.asmx';
HTTPRIO1.Service:='Service1';
InvRegistry.RegisterInvokeOptions(TypeInfo(Service1Soap), ioDocument);
editdosyaAdi.Text:=(HTTPRIO1 as Service1Soap).dosyaUzantisiBul(editdosyaAdi.Text);
end;
procedure TanaForm.HTTPRIO1BeforeExecute(const MethodName: String;
var SOAPRequest: WideString);
begin
istekMemo.Clear;
istekMemo.Lines.Add('Istek Yapilan Method :'+MethodName);
istekMemo.Lines.Add('XML istek :'+SOAPRequest);
end;
//xml istegin cevabi alinirken isletilen method
procedure TanaForm.HTTPRIO1HTTPWebNode1ReceivingData(Read, Total: Integer);
begin
ProgressBarOkunan.Max:=Total;
ProgressBarOkunan.Position:=Read;
end;
//xml istek gönderilirken isletin method
procedure TanaForm.HTTPRIO1HTTPWebNode1PostingData(Sent, Total: Integer);
begin
// Maximuma Toplam Büyüklügü aktar
ProgressBarGonderilen.Max:=Total;
// Aktif duruma gönderileni aktar
ProgressBarGonderilen.Position:=Sent;
end;
// Tersten yaz Dügmesi
procedure TanaForm.btnTerstenYazClick(Sender: TObject);
begin
Application.ProcessMessages;
HTTPRIO1.URL:='http://localhost:2210/Service1.asmx';
HTTPRIO1.Service:='Service1'; // servis adi
// Xml istegi gönder
InvRegistry.RegisterInvokeOptions(TypeInfo(Service1Soap), ioDocument);
editMetin.Text:=(HTTPRIO1 as Service1Soap).Terstenyaz(editMetin.Text);
end;
// istek yollandiktan sonra
procedure TanaForm.HTTPRIO1AfterExecute(const MethodName: String;SOAPResponse: TStream);
begin
// gelen Xml cevabi al
cevapMemo.Lines.LoadFromStream(SOAPResponse);
cevapMemo.Lines.Add('Cevap veren method :'+MethodName);
end;
end.
|