Note that there are some explanatory texts on larger screens.

plurals
  1. POSerialization error when calling WCF service
    text
    copied!<p>When I call the service I receive this error:</p> <blockquote> <p>Element ListadoClientesResult from namespace tempuri.org cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML</p> </blockquote> <p>The service code is:</p> <pre><code>public List&lt;Empleado&gt; ListarEmpleados() { List&lt;Empleado&gt; returnList = new List&lt;Empleado&gt;(); var lista = from u in DB.tabEmpleado select new { u.idEmpleado, u.idUsuario, u.Nombre, u.Apellidos, u.Telefono1 }; foreach (var e in lista) { Empleado empleado = new Empleado(); empleado.idEmpleado = e.idEmpleado; empleado.idUsuario = e.idUsuario; empleado.nombre = e.Nombre; empleado.apellidos = e.Apellidos; empleado.telefono1 = e.Telefono1; returnList.Add(empleado); } return returnList; } </code></pre> <p>And the class definition is this:</p> <pre><code> [DataContract] public class Empleado { private int _idEmpleado; [DataMember(IsRequired = false)] public int idEmpleado { get { return _idEmpleado; } set { _idEmpleado = value; } } private int _idUsuario; [DataMember(IsRequired = false)] public int idUsuario { get { return _idUsuario; } set { _idUsuario = value; } } private string _nombre; [DataMember(IsRequired = false)] public string nombre { get { return _nombre; } set { _nombre = value; } } private string _apellidos; [DataMember(IsRequired = false)] public string apellidos { get { return _apellidos; } set { _apellidos = value; } } private string _telefono1; [DataMember(IsRequired = false)] public string telefono1 { get { return _telefono1; } set { _telefono1 = value; } } } </code></pre> <p>Here is the ServiceContract</p> <pre><code> namespace MetodosNegocio { [ServiceContract] public interface IService { [OperationContract] List&lt;Empleado&gt; ListadoClientes(); } } </code></pre> <p>How can I solve this problem?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload