İlaç Takip Sistemi için Depo tarafında DepoDoğrulamaBildirimi yazmak istiyorum. Delphi 7 ile bayağı uğraşıp sonuş alamadıktan sonra Delphi 2010'la en sonunda
Soap Envelopenu aşağıdaki kodla oluşturdum
Kod: Tümünü seç
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,Types, XSBuiltIns, InvokeRegistry, Rio,
SOAPHTTPClient;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Memo1: TMemo;
HTTPRIO1: THTTPRIO;
Memo2: TMemo;
procedure BitBtn1Click(Sender: TObject);
procedure HTTPRIO1BeforeExecute(const MethodName: string;
SOAPRequest: TStream);
procedure HTTPRIO1AfterExecute(const MethodName: string;
SOAPResponse: TStream);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses DepoUrunDogrulama;
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
srv:DepoDogrulamaBildirimReceiver;
Bildir:DepoDogrulamaBildirim;
cvp:DepoDogrulamaBildirimCevap;
stkl: URUNLER2;
HKOD: BildirimHataType;
HATA:BildirimHata;
begin
httprio1.HTTPWebNode.UserName:='depo';
httprio1.HTTPWebNode.Password:='sifre';
srv:=GetDepoDogrulamaBildirimReceiver(False,'',HTTPRio1);
Bildir:= DepoDogrulamaBildirim.Create;
Bildir.DT:='V';
Bildir.FR:='8680001081790';
SetLength(stkl,2);
Bildir.URUNLER:=stkl;
Stkl[0]:=URUN.Create;
Stkl[0].GTIN:='08699809950320';
Stkl[0].BN:='36201';
Stkl[0].SN:='10000001247694';
Stkl[0].XD:=TxsDate.Create;
Stkl[0].XD.XSToNative('2012-12-31');
Stkl[1]:=URUN.Create;
Stkl[1].GTIN:='08699809950320';
Stkl[1].BN:='36201';
Stkl[1].SN:='10000001247702';
Stkl[1].XD:=TxsDate.Create;
Stkl[1].XD.XSToNative('2012-12-31');
cvp:=DepoDogrulamaBildirimCevap.Create;
try
cvp:=srv.DepoDogrulamaBildir(Bildir);
except
on E: ERemotableException do
begin
showmessage(e.FaultCode);
end;
end;
Bildir.Free;
cvp.Free;
//hkod.Free;
//hata.Free;
srv:=Nil;
end;
procedure TForm1.HTTPRIO1AfterExecute(const MethodName: string;
SOAPResponse: TStream);
begin
memo2.Clear;
SoapResponse.Position:=0;
memo2.Lines.LoadFromStream(SoapResponse);
end;
procedure TForm1.HTTPRIO1BeforeExecute(const MethodName: string;
SOAPRequest: TStream);
begin
memo1.Clear;
SoapRequest.Position:=0;
memo1.Lines.LoadFromStream(SoapRequest);
end;
end.
ve sonuçta bu Response Envelop'u oluştu
Kod: Tümünü seç
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body><DepoDogrulamaBildirim xmlns="http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo">
<DT xmlns="">V</DT>
<FR xmlns="">8680001081790</FR>
<URUNLERxmlns="">
<URUN><GTIN>08699809950320</GTIN><BN>36201</BN><SN>10000001247694</SN><XD>2012-12- 31</XD></URUN><URUN><GTIN>08699809950320</GTIN><BN>36201</BN><SN>10000001247702</SN><XD>2012-12-31</XD></URUN></URUNLER></DepoDogrulamaBildirim></SOAP-ENV:Body></SOAP-ENV:Envelope>
Kod: Tümünü seç
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:depo="http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo">
<soapenv:Header/>
<soapenv:Body>
<depo:DepoDogrulamaBildirim>
<DT>V</DT>
<FR>8680001081790</FR>
<URUNLER>
<URUN>
<GTIN>08699809950320</GTIN>
<BN>36201</BN>
<SN>10000001247694</SN>
<XD>2012-12- 31</XD>
</URUN>
<URUN>
<GTIN>08699809950320</GTIN>
<BN>36201</BN>
<SN>10000001247702</SN>
<XD>2012-12-31</XD>
</URUN>
</URUNLER>
</depo:DepoDogrulamaBildirim>
</soapenv:Body>
</soapenv:Envelope>
xmlns:depo="http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"> nasıl ekleyebilirim ve - xmlns="" - den nasıl kurtulabilirim.
Ayrıca BildirimHata'yı nasıl yakalamam ve işlemem lazım. Wsdl adresihttp://www.iegm.gov.tr/Folders/file/its ... ulama.wsdl
benim import ettiğim wsdl unit ise
Kod: Tümünü seç
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://www.iegm.gov.tr/Folders/file/its/wsdl/DepoUrunDogrulama.wsdl
// >Import : http://www.iegm.gov.tr/Folders/file/its/wsdl/DepoUrunDogrulama.wsdl>0
// Encoding : UTF-8
// Version : 1.0
// (03.05.2010 02:42:09 - - $Rev: 24171 $)
// ************************************************************************ //
unit DepoUrunDogrulama;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
const
IS_UNBD = $0002;
IS_UNQL = $0008;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:date - "http://www.w3.org/2001/XMLSchema"[Gbl]
DepoDogrulamaBildirimCevapType = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Lit][GblCplx] }
URUNDURUM = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Cplx] }
BildirimHataType = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[GblCplx] }
DepoDogrulamaBildirimType = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Lit][GblCplx] }
URUN = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Cplx] }
BildirimHata = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Flt][GblElm] }
DepoDogrulamaBildirimCevap = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Lit][GblElm] }
DepoDogrulamaBildirim = class; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Lit][GblElm] }
URUNLER = array of URUNDURUM; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Cplx] }
// ************************************************************************ //
// XML : DepoDogrulamaBildirimCevapType, global, <complexType>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
DepoDogrulamaBildirimCevapType = class(TRemotable)
private
FBILDIRIMID: string;
FURUNLER: URUNLER;
public
constructor Create; override;
destructor Destroy; override;
published
property BILDIRIMID: string Index (IS_UNQL) read FBILDIRIMID write FBILDIRIMID;
property URUNLER: URUNLER Index (IS_UNQL) read FURUNLER write FURUNLER;
end;
GTIN = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
SN = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
UC = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
// ************************************************************************ //
// XML : URUNDURUM, <complexType>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// ************************************************************************ //
URUNDURUM = class(TRemotable)
private
FGTIN: GTIN;
FSN: SN;
FUC: UC;
published
property GTIN: GTIN Index (IS_UNQL) read FGTIN write FGTIN;
property SN: SN Index (IS_UNQL) read FSN write FSN;
property UC: UC Index (IS_UNQL) read FUC write FUC;
end;
FC = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
// ************************************************************************ //
// XML : BildirimHataType, global, <complexType>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// ************************************************************************ //
BildirimHataType = class(TRemotable)
private
FFC: FC;
FFM: string;
published
property FC: FC Index (IS_UNQL) read FFC write FFC;
property FM: string Index (IS_UNQL) read FFM write FFM;
end;
DT = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
FR = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
URUNLER2 = array of URUN; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Cplx] }
// ************************************************************************ //
// XML : DepoDogrulamaBildirimType, global, <complexType>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
DepoDogrulamaBildirimType = class(TRemotable)
private
FDT: DT;
FFR: FR;
FURUNLER: URUNLER2;
public
constructor Create; override;
destructor Destroy; override;
published
property DT: DT Index (IS_UNQL) read FDT write FDT;
property FR: FR Index (IS_UNQL) read FFR write FFR;
property URUNLER: URUNLER2 Index (IS_UNQL) read FURUNLER write FURUNLER;
end;
GTIN2 = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
BN = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
SN2 = type string; { "http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo"[Smpl] }
// ************************************************************************ //
// XML : URUN, <complexType>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// ************************************************************************ //
URUN = class(TRemotable)
private
FGTIN: GTIN2;
FBN: BN;
FSN: SN2;
FXD: TXSDate;
public
destructor Destroy; override;
published
property GTIN: GTIN2 Index (IS_UNQL) read FGTIN write FGTIN;
property BN: BN Index (IS_UNQL) read FBN write FBN;
property SN: SN2 Index (IS_UNQL) read FSN write FSN;
property XD: TXSDate Index (IS_UNQL) read FXD write FXD;
end;
// ************************************************************************ //
// XML : BildirimHata, global, <element>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// Info : Fault
// Base Types: BildirimHataType
// ************************************************************************ //
BildirimHata = class(ERemotableException)
private
FFC: FC;
FFM: string;
published
property FC: FC Index (IS_UNQL) read FFC write FFC;
property FM: string Index (IS_UNQL) read FFM write FFM;
end;
// ************************************************************************ //
// XML : DepoDogrulamaBildirimCevap, global, <element>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// Info : Wrapper
// ************************************************************************ //
DepoDogrulamaBildirimCevap = class(DepoDogrulamaBildirimCevapType)
private
published
end;
// ************************************************************************ //
// XML : DepoDogrulamaBildirim, global, <element>
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// Info : Wrapper
// ************************************************************************ //
DepoDogrulamaBildirim = class(DepoDogrulamaBildirimType)
private
published
end;
// ************************************************************************ //
// Namespace : http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo
// soapAction: http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/DepoDogrulamaBildirimRequest
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : DepoDogrulamaReceiverBinding
// service : DepoDogrulamaReceiverService
// port : DepoDogrulamaBildirimReceiverBindingPort
// URL : http://itstest:8080/DepoDogrulama/DepoDogrulamaReceiverService
// ************************************************************************ //
DepoDogrulamaBildirimReceiver = interface(IInvokable)
['{01F4B368-0997-50B5-2AEE-4BA1D636EDC6}']
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - More than one strictly out element was found
function DepoDogrulamaBildir(const body: DepoDogrulamaBildirim): DepoDogrulamaBildirimCevap; stdcall;
end;
function GetDepoDogrulamaBildirimReceiver(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): DepoDogrulamaBildirimReceiver;
implementation
uses SysUtils;
function GetDepoDogrulamaBildirimReceiver(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): DepoDogrulamaBildirimReceiver;
const
defWSDL = 'http://www.iegm.gov.tr/Folders/file/its/wsdl/DepoUrunDogrulama.wsdl';
defURL = 'http://itstest:8080/DepoDogrulama/DepoDogrulamaReceiverService';
defSvc = 'DepoDogrulamaReceiverService';
defPrt = 'DepoDogrulamaBildirimReceiverBindingPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as DepoDogrulamaBildirimReceiver);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
constructor DepoDogrulamaBildirimCevapType.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor DepoDogrulamaBildirimCevapType.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(FURUNLER)-1 do
SysUtils.FreeAndNil(FURUNLER[I]);
System.SetLength(FURUNLER, 0);
inherited Destroy;
end;
constructor DepoDogrulamaBildirimType.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor DepoDogrulamaBildirimType.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(FURUNLER)-1 do
SysUtils.FreeAndNil(FURUNLER[I]);
System.SetLength(FURUNLER, 0);
inherited Destroy;
end;
destructor URUN.Destroy;
begin
SysUtils.FreeAndNil(FXD);
inherited Destroy;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(DepoDogrulamaBildirimReceiver), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(DepoDogrulamaBildirimReceiver), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/DepoDogrulamaBildirimRequest');
InvRegistry.RegisterInvokeOptions(TypeInfo(DepoDogrulamaBildirimReceiver), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(DepoDogrulamaBildirimReceiver), ioLiteral);
InvRegistry.RegisterExternalParamName(TypeInfo(DepoDogrulamaBildirimReceiver), 'DepoDogrulamaBildir', 'body1', 'body');
RemClassRegistry.RegisterXSInfo(TypeInfo(URUNLER), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'URUNLER');
RemClassRegistry.RegisterXSClass(DepoDogrulamaBildirimCevapType, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'DepoDogrulamaBildirimCevapType');
RemClassRegistry.RegisterSerializeOptions(DepoDogrulamaBildirimCevapType, [xoLiteralParam]);
RemClassRegistry.RegisterXSInfo(TypeInfo(GTIN), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'GTIN');
RemClassRegistry.RegisterXSInfo(TypeInfo(SN), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'SN');
RemClassRegistry.RegisterXSInfo(TypeInfo(UC), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'UC');
RemClassRegistry.RegisterXSClass(URUNDURUM, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'URUNDURUM');
RemClassRegistry.RegisterXSInfo(TypeInfo(FC), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'FC');
RemClassRegistry.RegisterXSClass(BildirimHataType, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'BildirimHataType');
RemClassRegistry.RegisterXSInfo(TypeInfo(DT), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'DT');
RemClassRegistry.RegisterXSInfo(TypeInfo(FR), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'FR');
RemClassRegistry.RegisterXSInfo(TypeInfo(URUNLER2), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'URUNLER2', 'URUNLER');
RemClassRegistry.RegisterXSClass(DepoDogrulamaBildirimType, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'DepoDogrulamaBildirimType');
RemClassRegistry.RegisterSerializeOptions(DepoDogrulamaBildirimType, [xoLiteralParam]);
RemClassRegistry.RegisterXSInfo(TypeInfo(GTIN2), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'GTIN2', 'GTIN');
RemClassRegistry.RegisterXSInfo(TypeInfo(BN), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'BN');
RemClassRegistry.RegisterXSInfo(TypeInfo(SN2), 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'SN2', 'SN');
RemClassRegistry.RegisterXSClass(URUN, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'URUN');
RemClassRegistry.RegisterXSClass(BildirimHata, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'BildirimHata');
RemClassRegistry.RegisterXSClass(DepoDogrulamaBildirimCevap, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'DepoDogrulamaBildirimCevap');
RemClassRegistry.RegisterXSClass(DepoDogrulamaBildirim, 'http://its.iegm.gov.tr/bildirim/BR/v1/Dogrulama/Depo', 'DepoDogrulamaBildirim');
end.