1
I need to send an object from a class that I created to a webservice, but when I call the method passing the object it to the types are incompatible. I tried to receive the object as Object, but it gives an error when generating XML document. How can I send this object?
Example: User:
[Serializable]
public class Usuario
{
String _Nome;
public String Nome {
get { return _Nome;}
set { _Nome = value; }
}
}
A method that passes an object to my webservice as follows:
{
...
WS.InformarNome(usuario);
}
And the webservice receives the user:
public void InformarNome(Usuario u) { ... }
Could provide a code example of what was done?
– Filipe Oliveira
I have a User class: [Serializable] public class Usuario { String _Name; public String Name { get { Return _Name;} set { _Name = value; } } } A method that passes an object to my webservice as follows: ... WS.Informname(user); And the webservice receives the user: ... public void Informname(User u) { ... }
– Murilo Fechio
The best is to edit your question and put the code, it is more readable. http://answall.com/posts/45143/edit
– Filipe Oliveira
Edited, thank you very much!
– Murilo Fechio
Following the code you posted no error happened to me. The user you are ordering on
ws.InformarNome(usuario)
is a User object or an Object?– Filipe Oliveira
Type Same user
– Murilo Fechio