Bu, dökümanın eski bir sürümüdür!
using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Net; using System.Text; namespace AHBS2014 { public static class KDSIslemleri { static HttpWebResponse wr; static HttpWebRequest rica; public static class PerformansSorgulamaTipiYolu { public static string RaporYoluGenelPerformans = "/shared/LİSTE RAPORLARI/Performans Genel Raporu"; public static string RaporYoluBebekAsi = "/shared/LİSTE RAPORLARI/Performans Bebek Aşı Raporu"; public static string RaporYoluBebekIzlem = "/shared/LİSTE RAPORLARI/Performans Bebek İzlem Raporu"; public static string RaporYoluGebeIzlem = "/shared/LİSTE RAPORLARI/Performans Gebe İzlem Raporu"; public static string RaporYoluCocukIzlem = "/shared/LİSTE RAPORLARI/Performans Çocuk İzlem Raporu"; } public static class PerformansSorgulamaTipiAdi { public static string RaporAdiGenelPerformans = "Perf Genel Raporu"; public static string RaporAdiBebekAsi = "Perf Bebek Aşı Raporu"; public static string RaporAdiBebekIzlem = "Perf Bebek İzlem Raporu"; public static string RaporAdiGebeIzlem = "Perf Gebe İzlem Raporu"; public static string RaporAdiCocukIzlem = "Perf Cocuk İzlem Raporu"; } private static HttpWebRequest mesajolusturKDS(string Uri, string xml) { HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(Uri); // Init HTTP Request httpRequest.Method = "POST"; httpRequest.ContentType = "text/xml; charset=utf-8"; Stream reqStream = httpRequest.GetRequestStream(); StreamWriter sw = null; sw = new StreamWriter(reqStream, Encoding.UTF8); StringBuilder soapRequest = new StringBuilder(); soapRequest.Append("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "); soapRequest.Append(" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" "); soapRequest.Append( " xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" "); soapRequest.Append( " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">"); // SOAP BODY soapRequest.Append("<soap:Body>"); soapRequest.Append(xml); soapRequest.Append("</soap:Body>"); // END soapRequest.Append("</soap:Envelope>"); sw.Write(soapRequest.ToString().Trim()); sw.Close(); reqStream.Close(); return httpRequest; } public static string KDSKontrol(string Yil, string Ay, string Sabitler_PerformansSorgulamaTipiYolu, string Sabitler_PerformansSorgulamaTipiAdi, int beklemesuresi) { try { string SessionId = @"<logon xmlns=""urn://oracle.bi.webservices/v6""><name>" + KullaniciKarti.AktifKullanici.SAGLIK_NET_KULLANICI_KODU.ToString() + "</name><password>" + KullaniciKarti.AktifKullanici.SAGLIK_NET_SIFRESI + @"</password></logon>"; wr = null; rica = mesajolusturKDS(@"https://kds.sagliknet.saglik.gov.tr/analytics/saw.dll?SoapImpl=nQSessionService", SessionId); rica.Timeout = beklemesuresi; wr = (HttpWebResponse)rica.GetResponse(); StreamReader srd = new StreamReader(wr.GetResponseStream()); SessionId = srd.ReadToEnd(); wr.Close(); if (SessionId.Contains(@"<sawsoap:sessionID xsi:type=""xsd:string"">") && SessionId.Contains("</sawsoap:sessionID>")) { string[] Parcalanmis = SessionId.Split(new string[] { @"<sawsoap:sessionID xsi:type=""xsd:string"">", "</sawsoap:sessionID>" }, StringSplitOptions.RemoveEmptyEntries); SessionId = Parcalanmis[1]; string xml = @"<executeXMLQuery xmlns=""urn://oracle.bi.webservices/v6""> <report> <reportPath>" + Sabitler_PerformansSorgulamaTipiYolu + @"</reportPath> <reportXml /> </report> <outputFormat>SAWRowsetSchemaAndData</outputFormat> <executionOptions> <async>true</async> <maxRowsPerPage>1000</maxRowsPerPage> <refresh>true</refresh> <presentationInfo>true</presentationInfo> </executionOptions> <reportParams> <filterExpressions><sawx:expr xsi:type=""sawx:comparison"" op=""equal"" xmlns:saw=""com.siebel.analytics.web/report/v1.1"" xmlns:sawx=""com.siebel.analytics.web/expression/v1.1"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <sawx:expr xsi:type=""sawx:sqlExpression"">""" + Sabitler_PerformansSorgulamaTipiAdi + @""".""Hekim Tc""</sawx:expr> <sawx:expr xsi:type=""xsd:double"">" + KullaniciKarti.AktifKullanici.SAGLIK_NET_KULLANICI_KODU.ToString() + @"</sawx:expr></sawx:expr></filterExpressions> <filterExpressions><sawx:expr xsi:type=""sawx:comparison"" op=""equal"" xmlns:saw=""com.siebel.analytics.web/report/v1.1"" xmlns:sawx=""com.siebel.analytics.web/expression/v1.1"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <sawx:expr xsi:type=""sawx:sqlExpression"">""Dim Organizasyon"".""Birim Kurum Kodu""</sawx:expr> <sawx:expr xsi:type=""xsd:double"">" + KullaniciKarti.AktifKullanici.KURUM_KODU + @"</sawx:expr></sawx:expr></filterExpressions> <filterExpressions><sawx:expr xsi:type=""sawx:comparison"" op=""equal"" xmlns:saw=""com.siebel.analytics.web/report/v1.1"" xmlns:sawx=""com.siebel.analytics.web/expression/v1.1"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <sawx:expr xsi:type=""sawx:sqlExpression"">""" + Sabitler_PerformansSorgulamaTipiAdi + @""".""Yıl Ay""</sawx:expr> <sawx:expr xsi:type=""xsd:double"">" + Yil + Ay + @"</sawx:expr></sawx:expr></filterExpressions> </reportParams> <sessionID>" + SessionId + @"</sessionID> </executeXMLQuery>"; wr = null; try { rica = mesajolusturKDS(@"https://kds.sagliknet.saglik.gov.tr/analytics/saw.dll?SoapImpl=xmlViewService", xml); rica.Timeout = beklemesuresi; wr = (HttpWebResponse)rica.GetResponse(); srd = new StreamReader(wr.GetResponseStream()); string resulXmlFromWebService = srd.ReadToEnd().Replace("T00:00:00+01:00", "").Replace("T00:00:00+02:00", "").Replace("T00:00:00+03:00", "").Replace("T00:00:00+04:00", "").Replace("T00:00:00+05:00", "").Replace("+01:00<", "+02:00<").Replace("+03:00<", "+02:00<").Replace("+04:00<", "+02:00<").Replace("+05:00<", "+02:00<"); wr.Close(); return resulXmlFromWebService; } catch (Exception ex) { return "Sorgulama Başarısız\nHata : " + ex.Message; } } else return "Login Başarısız\nHata : " + SessionId; } catch (Exception genelex) { return "Sorgulama Başarısız\nHata : " + genelex.Message; } } } }