public factura Deserializar_factura_SRI(string path, ref string numAutorizacion, ref DateTime fechAutoriza, ref string mensaje) { XmlDocument xmlComprobanteOrigen = new XmlDocument(); try { factura info_factura = new factura(); DateTime sFechaAuto = DateTime.Now; string sNum_Autorizacion = ""; //leyendo el xml de la base xmlComprobanteOrigen.Load(new StreamReader(path)); //ENCONTRANDO EL NODO TOKEN CON ESTE SE FIRMARA XmlNode xmlNode_f; XmlNode xmlNode_N_Auto; XmlElement root = xmlComprobanteOrigen.DocumentElement; xmlNode_f = root.SelectSingleNode("//fechaAutorizacion"); if (xmlNode_f != null)// es un xml q fue recibido y tiene soap { sFechaAuto = Convert.ToDateTime(xmlNode_f.FirstChild.Value); fechAutoriza = sFechaAuto; xmlNode_N_Auto = root.SelectSingleNode("//numeroAutorizacion"); if (xmlNode_N_Auto == null) // no esta autorizado { sNum_Autorizacion = "NO AUTORIZADO"; } else { sNum_Autorizacion = xmlNode_N_Auto.FirstChild.Value; } numAutorizacion = sNum_Autorizacion; string sXml_a_descerializar; sXml_a_descerializar = Quitar_a_xml_CDATA_y_Signature(xmlComprobanteOrigen.GetElementsByTagName("comprobante")[0].InnerXml); XmlDocument xmlCbte_a_descr = new XmlDocument(); xmlCbte_a_descr.Load(new StringReader(sXml_a_descerializar)); info_factura = (factura)Deserialize(xmlCbte_a_descr, info_factura.GetType()); } else { info_factura = (factura)Deserialize(xmlComprobanteOrigen, info_factura.GetType()); } return(info_factura); } catch (Exception ex) { xmlComprobanteOrigen = null; string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); return(new factura()); } }