How to expose only a few table columns in a Webservice via SOAP?

Asked

Viewed 21 times

0

How to expose just a few columns of in a Webservice ?
Example:

I need to expose just the Name and Surname table:

public class Cliente 
{
   public string Nome {get; set;}
   public string SobreNome {get; set;}
   public string CPF {get; set;}
}

[WebMethod]
public Cliente RetrieveDevice(Cliente Cliente)
{
    Cliente cli = new Cliente();
    Negocio objNegocio = new Negocio();
    cli = objNegocio.getCliente(Cliente);
    return cli;
}

1 answer

1


You can do this using the attribute [XmlIgnore()] on the property you do not want to be serialized, in this case the CPF property:

public class Cliente 
{
   public string Nome {get; set;}
   public string SobreNome {get; set;}

   [XmlIgnore()]
   public string CPF {get; set;}
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.