示例#1
0
        private void SendDxfMessage(DxfMessage message)
        {
            try
            {
                XmlSerializer xsz = new XmlSerializer(typeof(DxfMessage));
                using (XmlWriter xw = XmlWriter.Create(String.Format("datavalues-{0}.dxf", DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss")), new XmlWriterSettings()
                {
                    Indent = true
                }))
                    xsz.Serialize(xw, message);

                RestUtil util = new RestUtil(new Uri(ConfigurationManager.AppSettings["DHIS_URL"]));
                util.PostXml("dataValueSets", message, ConfigurationManager.AppSettings["DHIS_UN"], ConfigurationManager.AppSettings["DHIS_PWD"]);
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
            }
        }