private static VeriAl.VeriAl GetWebSrvc() { VeriAl.VeriAl webSrvc = new VeriAl.VeriAl(); // Web servisi adresini app.config den okuyoruz. webSrvc.Url = ConfigurationManager.AppSettings["WSGonderme"]; return(webSrvc); }
bool f_WebServiseGonder(DataSet _ds) { VeriAl.VeriAl webSrvc = GetWebSrvc(); try { if (string.IsNullOrEmpty(webSrvc.Url)) { MessageBox.Show( "Verileri gönderebilmek için Web Servisi ayarları yapmalısınız." + Environment.NewLine + "Bunun için Ayarlar->Servis Ayarları ekranını kullanabilirsiniz.", "Ayarlar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } // Girilmiş web servisi adresi doğru mu? if (!Uri.IsWellFormedUriString(webSrvc.Url, UriKind.Absolute)) { MessageBox.Show("Kayıtlı olan web servisi adresi doğru tanımlanmamıştır.", "Ayarlar", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } catch (Exception ex) { ex.LogException("Verileri eşleştirmek için kullanılacak Web Servisi adresi doğrulanırken genel istisna fırlatıldı."); #if DEBUG throw (ex); #endif } // Verileri web servisi ile gönderme kısmı. bool bSonuc = false; try { bSonuc = webSrvc.f_VeriAl(_ds); } catch (Exception ex) { //--IS MemoryStream ms = new MemoryStream(); _ds.WriteXml(ms); StreamReader sr = new StreamReader(ms); ex.LogException(sr.ReadToEnd()); #if DEBUG throw (ex); #endif } return(bSonuc); }