Delphi üzerinde gerçekleştirilmiş XML-POST ve WEBSERVICE hizmetlerimizin Api kod örneklerini hazırladık>
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
Menus, StdCtrls;
type
TForm1 = class(TForm)
TIdHTTP: TIdHTTP;
kad: TEdit;
sifre: TEdit;
kno: TEdit;
orji: TEdit;
nu1: TEdit;
mesaj: TMemo;
Button1: TButton;
durum: TMemo;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
nu2: TEdit;
Label8: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function POST (url,xmlstring:WideString):string;
var
datalistesi: TStringList;
HTTP: TIdHTTP;
cevap: string;
utff: string;
begin
HTTP := TIdHTTP.Create(nil);
HTTP.Request.Accept:='*/*';
HTTP.Request.ContentType:='application/x-www-form-urlencoded';
datalistesi := TStringList.Create;
utff:=UTF8Encode(xmlstring);
datalistesi.Add(utff);
cevap := HTTP.Post(url,datalistesi);
datalistesi.Free;
HTTP.Free;
Result:=cevap;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
xml,url:string;
begin
url:='http://panel.vatansms.com/panel/smsgonder1Npost.php';
xml:= 'data=<sms><kno>'+kno.Text+'</kno>'+
'<kulad>'+kad.Text+'</kulad>' +
'<sifre>'+sifre.Text+'</sifre>' +
'<gonderen>'+orji.Text+'</gonderen>' +
'<mesaj>'+mesaj.Text+'</mesaj>' +
'<numaralar>'+nu1.Text+','+nu2.Text+'</numaralar>'+
'<tur>Normal</tur>' + //Normal yada Turkce olabilir
'</sms>';
//Xml'in içinde aşağıdaki alanları ekleyebilirsiniz.
// '<zaman>2013-11-05 15:00:00</zaman>'+ İleri tarihli mesaj için kullanabilirsiniz.
Form1.durum.Lines.Add(POST(url,xml));
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
Menus, StdCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
TIdHTTP: TIdHTTP;
kad: TEdit;
sifre: TEdit;
kno: TEdit;
orji: TEdit;
nu1: TEdit;
mesaj1: TMemo;
Button1: TButton;
durum: TMemo;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
nu2: TEdit;
Label8: TLabel;
mesaj2: TMemo;
Label9: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function POST (url,xmlstring:WideString):string;
var
datalistesi: TStringList;
HTTP: TIdHTTP;
cevap: string;
utff: string;
begin
HTTP := TIdHTTP.Create(nil);
HTTP.Request.Accept:='*/*';
HTTP.Request.ContentType:='application/x-www-form-urlencoded';
datalistesi := TStringList.Create;
utff:=UTF8Encode(xmlstring);
datalistesi.Add(utff);
cevap := HTTP.Post(url,datalistesi);
datalistesi.Free;
HTTP.Free;
Result:=cevap;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
xml,url:string;
begin
url:='http://panel.vatansms.com/panel/smsgonderNNpost.php';
xml:= 'data=<sms><kno>'+kno.Text+'</kno>'+
'<kulad>'+kad.Text+'</kulad>' +
'<sifre>'+sifre.Text+'</sifre>' +
'<gonderen>'+orji.Text+'</gonderen>' +
'<telmesajlar>'+
'<telmesaj><tel>'+nu1.Text+'</tel><mesaj>'+mesaj1.Text+'</mesaj></telmesaj>' +
'<telmesaj><tel>'+nu2.Text+'</tel><mesaj>'+mesaj2.Text+'</mesaj></telmesaj>' +
'</telmesajlar>'+
'<tur>Normal</tur>' + //Normal yada Turkce olabilir
'</sms>';
//Xml'in içinde aşağıdaki alanları ekleyebilirsiniz.
// '<zaman>2013-11-05 15:00:00</zaman>'+ İleri tarihli mesaj için kullanabilirsiniz.
Form1.durum.Lines.Add(POST(url,xml));
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
Menus, StdCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
TIdHTTP: TIdHTTP;
kad: TEdit;
sifre: TEdit;
Button1: TButton;
sonuc: TMemo;
Label1: TLabel;
Label2: TLabel;
Label7: TLabel;
ozelkod: TEdit;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function POST (url,xmlstring:WideString):string;
var
datalistesi: TStringList;
HTTP: TIdHTTP;
cevap: string;
utff: string;
begin
HTTP := TIdHTTP.Create(nil);
HTTP.Request.Accept:='*/*';
HTTP.Request.ContentType:='application/x-www-form-urlencoded';
datalistesi := TStringList.Create;
utff:=UTF8Encode(xmlstring);
datalistesi.Add(utff);
cevap := HTTP.Post(url,datalistesi);
datalistesi.Free;
HTTP.Free;
Result:=cevap;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
xml,url:string;
begin
url:='http://panel.vatansms.com/panel/smstakippost.php';
xml:= 'data=<smsrapor>'+
'<kulad>'+kad.Text+'</kulad>' +
'<sifre>'+sifre.Text+'</sifre>' +
'<ozelkod>'+ozelkod.Text+'</ozelkod>' +
'</smsrapor>';
Form1.sonuc.Lines.Add(POST(url,xml));
end;
end.
************************************************************************
The types declared in this file were generated from data read from the
WSDL File described below:
WSDL : http://panel.vatansms.com/webservis/service.php?wsdl
Encoding : ISO-8859-1
Codegen : [wfDebug,wfUseSerializerClassForAttrs]
Version : 1.0
************************************************************************