public bool TryGetOrder(string accession, out OrderData orderData) { orderData = null; try { string uri = "services/explorer.asmx/SearchByAccession"; string param = $"site=&accessions={accession}&sort="; if (_client.TryPost(uri, param, out string xmlContent)) { //TODO: figure out how to ignore xml namespaces. xmlContent = xmlContent.Replace("xmlns=\"http://nuance.com/commissure/webservices/explorer/2010/06\"", ""); orderData = XmlDeserialize <List <OrderData> > .Deserialize(xmlContent).FirstOrDefault(); return(orderData != null); } else { return(false); } } catch (Exception ex) { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); } return(false); }
public bool TryGetReport(string accession, out Report report) { report = null; if (string.IsNullOrWhiteSpace(accession)) { return(false); } try { if (TryGetOrder(accession, out OrderData order)) { string uri = "services/report.asmx/GetReport"; string param = $"reportID={order.ReportID}"; if (_client.TryPost(uri, param, out string xmlReport)) { //TODO: figure out how to ignore xml namespaces. xmlReport = xmlReport.Replace("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://nuance.com/commissure/webservices/report/2010/06\"", ""); report = XmlDeserialize <Report> .Deserialize(xmlReport); return(report != null); } } else { return(false); // order does not exist. } } catch (Exception ex) { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); } return(false); }