Ver Mensaje Individual
  #2077  
Antiguo 04-07-2017
jcapilla jcapilla is offline
Miembro
NULL
 
Registrado: feb 2017
Posts: 29
Reputación: 0
jcapilla Va por buen camino
Cita:
Empezado por batuzail Ver Mensaje
Hola,
Para convertir en xml la respuesta yo uso
Código:
        public  bool GetXMLFromObject(object o)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter tw = null;
            try
            {
                XmlSerializer serializer = new XmlSerializer(o.GetType());
                tw = new XmlTextWriter(sw);
                serializer.Serialize(tw, o);
            }
            catch (Exception ex)
            {
                //Handle Exception Code
                return false;
            }
            finally
            {
                sw.Close();
                if (tw != null)
                {
                    tw.Close();
                }
            }

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\tmp\" + o.ToString() + ".xml"))
            {
                file.WriteLine(sw.ToString());

            }
            return true;
        }
Creo que el problema es que el xml que devuelve AEAT (fichero) al deserializarlo con el objeto falla. Yo me encontre con el problema hace tiempo e incluso creo recordar que consulte por aqui. Si haces el replace digamos que el xml tiene el formato que espera la deserializacion.
Responder Con Cita