Hiç WEB servis deneyimim yok, C# ile yazılmış bir WEB servise Delphi 7 ile bağlanmam ve işin de mayıs sonuna yetişmesi gerekiyor. Bir kaç gündür internette araştırmalar yaparak aşağıdaki şekilde bir deneme oluşturdum. Servise bağlanmaya kalktığım anda access violation hatası alıyorum.
Yardımcı olacaklara şimdiden müteşekkirim. Saygılar,
Kod: Tümünü seç
Project DeneProje1.exe raised exception class EAccessViolation with message 'Access violation at address 004036FC in module 'DeneProje1.exe'. Read of address FFFFFFDD'. Process stopped. Use Step or Run to continue.
Kod: Tümünü seç
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : httP://gbo.isicamciyiz.biz/thirdparty.asmx?WSDL
// Encoding : utf-8
// Version : 1.0
// (11.05.2016 14:27:28 - 1.33.2.5)
// ************************************************************************ //
unit thirdparty;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
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 Borland 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"
// !:int - "http://www.w3.org/2001/XMLSchema"
// !:decimal - "http://www.w3.org/2001/XMLSchema"
// !:boolean - "http://www.w3.org/2001/XMLSchema"
GBO = class; { "http://tempuri.org/" }
Yanit = class; { "http://tempuri.org/" }
Urun = class; { "http://tempuri.org/" }
{ "http://tempuri.org/" }
urunSeri = (C, S, K);
// ************************************************************************ //
// Namespace : http://tempuri.org/
// ************************************************************************ //
GBO = class(TRemotable)
private
Fserviceuser: WideString;
Fservicepassword: WideString;
FcariId: WideString;
Fcaripassword: WideString;
FmusteriAdSoyad: WideString;
FfirmaAdi: WideString;
FfaturaTarihi: WideString;
FfaturaNo: WideString;
FvergiNo: WideString;
published
property serviceuser: WideString read Fserviceuser write Fserviceuser;
property servicepassword: WideString read Fservicepassword write Fservicepassword;
property cariId: WideString read FcariId write FcariId;
property caripassword: WideString read Fcaripassword write Fcaripassword;
property musteriAdSoyad: WideString read FmusteriAdSoyad write FmusteriAdSoyad;
property firmaAdi: WideString read FfirmaAdi write FfirmaAdi;
property faturaTarihi: WideString read FfaturaTarihi write FfaturaTarihi;
property faturaNo: WideString read FfaturaNo write FfaturaNo;
property vergiNo: WideString read FvergiNo write FvergiNo;
end;
// ************************************************************************ //
// Namespace : http://tempuri.org/
// ************************************************************************ //
Yanit = class(TRemotable)
private
FproductTable: WideString;
FQRcode: WideString;
FQRrefno: WideString;
FerrorMsg: WideString;
published
property productTable: WideString read FproductTable write FproductTable;
property QRcode: WideString read FQRcode write FQRcode;
property QRrefno: WideString read FQRrefno write FQRrefno;
property errorMsg: WideString read FerrorMsg write FerrorMsg;
end;
// ************************************************************************ //
// Namespace : http://tempuri.org/
// ************************************************************************ //
Urun = class(TRemotable)
private
FurunSeri: urunSeri;
Fadet: Integer;
Fmetrekare: TXSDecimal;
FucluSistem: Boolean;
FT: Boolean;
FR: Boolean;
FRF: Boolean;
FL: Boolean;
FAL: Boolean;
public
destructor Destroy; override;
published
property urunSeri: urunSeri read FurunSeri write FurunSeri;
property adet: Integer read Fadet write Fadet;
property metrekare: TXSDecimal read Fmetrekare write Fmetrekare;
property ucluSistem: Boolean read FucluSistem write FucluSistem;
property T: Boolean read FT write FT;
property R: Boolean read FR write FR;
property RF: Boolean read FRF write FRF;
property L: Boolean read FL write FL;
property AL: Boolean read FAL write FAL;
end;
// ************************************************************************ //
// Namespace : http://tempuri.org/
// soapAction: http://tempuri.org/%operationName%
// transport : http://schemas.xmlsoap.org/soap/http
// binding : thirdpartySoap
// service : thirdparty
// port : thirdpartySoap
// URL : http://gbo.isicamciyiz.biz/thirdparty.asmx
// ************************************************************************ //
thirdpartySoap = interface(IInvokable)
['{C0A37DD1-954E-2D47-CDAE-8C814EEB97F7}']
function garantiBelgesiOlustur(const garantiBelgesi: GBO): Yanit; stdcall;
procedure urunEkle(const yeniurun: Urun); stdcall;
end;
function GetthirdpartySoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): thirdpartySoap;
implementation
function GetthirdpartySoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): thirdpartySoap;
const
defWSDL = 'httP://gbo.isicamciyiz.biz/thirdparty.asmx?WSDL';
defURL = 'http://gbo.isicamciyiz.biz/thirdparty.asmx';
defSvc = 'thirdparty';
defPrt = 'thirdpartySoap';
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 thirdpartySoap);
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;
destructor Urun.Destroy;
begin
if Assigned(Fmetrekare) then
Fmetrekare.Free;
inherited Destroy;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(thirdpartySoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(thirdpartySoap), 'http://tempuri.org/%operationName%');
RemClassRegistry.RegisterXSInfo(TypeInfo(urunSeri), 'http://tempuri.org/', 'urunSeri');
RemClassRegistry.RegisterXSClass(GBO, 'http://tempuri.org/', 'GBO');
RemClassRegistry.RegisterXSClass(Yanit, 'http://tempuri.org/', 'Yanit');
RemClassRegistry.RegisterXSClass(Urun, 'http://tempuri.org/', 'Urun');
end.
Kod: Tümünü seç
implementation
uses thirdparty;
var
yGBO : GBO;
yUrun : Urun;
ySonuc : Yanit;
servis1 : thirdpartysoap;
{$R *.dfm}
procedure TGrnForm.FormCreate(Sender: TObject);
begin
yGBO := GBO.Create;
yUrun := Urun.Create;
ySonuc:= Yanit.Create;
servis1 := GetthirdpartySoap (true,'',nil);
// servis1 := GetthirdpartySoap ();
end;
procedure TGrnForm.BtnBelgeEkleClick(Sender: TObject);
begin
yGBO.FreeInstance;
ySonuc.FreeInstance;
yGBO.serviceuser := '';
yGBO.servicepassword := '';
yGBO.cariId := '100226';
yGBO.caripassword := '121240SA';
yGBO.faturaNo := EdFatNo.Text;
yGBO.faturaTarihi := EdFatTarih.Text;
yGBO.firmaAdi := EdBayi.Text;
// yGBO.vergiNo := EdVergiNo.Text;
yGBO.musteriAdSoyad := EdMusteri.Text;
// Aşağıdakilerin her ikisinde de aynı hata mesajını alıyorum
ySonuc := servis1.garantiBelgesiOlustur(yGBO);
// ySonuc := (HTTPRIO1 as thirdPartySoap).garantiBelgesiOlustur(yGBO);
yGBO.Free;
end;
procedure TGrnForm.BtnUrunEkleClick(Sender: TObject);
var
XsDec : TxsDecimal;
begin
yUrun.FreeInstance;
yUrun.adet := strToInt(EDAdet.Text);
XsDec := TXSDecimal.Create;
XsDec.DecimalString := Format('%f', [StrToFloat(edAlan.Text)]);
yurun.metrekare := xsdec;
if EdSeri.Text = 'C' then yUrun.urunSeri := C;
if EdSeri.Text = 'S' then yUrun.urunSeri := S;
if EdSeri.Text = 'K' then yUrun.urunSeri := K;
// Aşağıdakilerin her ikisinde de aynı hata mesajını alıyorum
// servis1.urunEkle(yUrun);
(HTTPRIO1 as thirdpartySoap).urunekle(yUrun);
end;