SERVİS BAĞLANTISI
Verilen örnekler C#
ile yazılmıştır.
EFaturaEDMPortClient client = new EFaturaEDMPortClient();
ÖNERİLEN HATA YAKALAMA MEKANİZMASI
Hata yakalama yöntemi, kademeli hata yakalama yöntemidir.
try
{
SendInvoiceResponse sendInvoiceResponse
= _service.SendInvoice(sendInvoiceRequest);
}
catch (System.ServiceModel.FaultException<REQUEST_ERRORType> fexp) // SERVİSTEN GÖNDERİLMİŞ İŞLEM HATASINI DÖNER
{
// REQUEST_ERRORType tipini çözümleyip, içindeki hata detaylarına ulaşmak gereklidir.
String detail = xmlSerializeObject(
(((System.ServiceModel.FaultException<REQUEST_ERRORType>)fexp)).Detail
);
var requesterror = (System.ServiceModel.FaultException<REQUEST_ERRORType>)fexp;
Console.WriteLine(fexp.Message);
Console.WriteLine(requesterror.Detail.ERROR_SHORT_DES);
Console.WriteLine(requesterror.Detail.ERROR_LONG_DES);
}
catch (System.ServiceModel.FaultException fex) // PROTOKOL İLE İLGİLİ SORUNLARI DÖNER
{
Console.WriteLine(fex.Message);
}
catch (Exception ex) // ÇAĞIRAN UYGUALAMA (CLIENT) TARAFINDAKİ BİR SORUNA İŞARET EDER
{
Console.WriteLine(ex.Message);
}