/// <summary> /// Read XML string send by EasyWarePro.</summary> /// <param name="strXmlMessage">message in xml format</param> /// <returns><c>true</c>: successfull</returns> /// <remarks>required</remarks> public string ReceiveXmlText(string strXmlMessage) { // Create the reader. System.Xml.XmlReader reader = System.Xml.XmlReader.Create(new System.IO.StringReader(strXmlMessage)); SReceiveMsgResponse sResponse = ReceiveXmlMessage(reader); if (String.IsNullOrEmpty(sResponse.ResponseFileName)) { return(sResponse.Message); } //write XML message to file using (StreamWriter sw = new StreamWriter(sResponse.ResponseFileName, false, Encoding.Unicode)) { if (String.IsNullOrEmpty(sResponse.Message)) { sw.Write(strXmlMessage); } else { sw.Write(sResponse.Message); } } return(""); }
/// <summary> /// Read XML file send by EasyWarePro.</summary> /// <param name="strPath">full path to the xml file</param> /// <returns><c>true</c>: successfull</returns> /// <remarks>required</remarks> protected string ReceiveXmlFile(string strPath) { // Create the reader. using (System.Xml.XmlReader reader = new System.Xml.XmlTextReader(strPath)) { try { SReceiveMsgResponse sResponse = ReceiveXmlMessage(reader); if (String.IsNullOrEmpty(sResponse.ResponseFileName)) { return(sResponse.Message); } //copy XML file if (File.Exists(strPath) && strPath != sResponse.ResponseFileName) { File.Copy(strPath, sResponse.ResponseFileName); } return(sResponse.Message); } finally { reader.Close(); //delete file try { if (File.Exists(strPath)) { File.Delete(strPath); } } catch { } } } }