I have the following code:
[WebMethod]
[SoapHeader("_webServiceAuth")]
public User GetUser(string username)
{
try
{
this._validationMethods.Validate(_webServiceAuth);
User user = new User(username);
return user;
}
catch (Exception ex)
{
throw ex;
}
}
As you can see, one would expect to receive a User as a responce when I do:
myUser = this.Service.GetUser(username);
But what I get is a request for a "GetUserRequest" instance, and get returned a "GetUserResponse" instance. Any help in why my object is not being send by my webservice?
asked Sep 29, 2010 at 1:39
-
2You should remove that try/catch block. It does nothing except screw up your stack when an exception is thrown. it will look like the exception came from the "throw" statement.John Saunders– John Saunders2010年09月30日 19:29:44 +00:00Commented Sep 30, 2010 at 19:29
-
True that, it's exactly what's doing and I find myself lost every time that happens!. Thanks for the tip :)Felix Martinez– Felix Martinez2010年10月02日 23:14:36 +00:00Commented Oct 2, 2010 at 23:14
1 Answer 1
You will find that the GetUserRequest object has a string property (username), and the GetUserResponse object contains your User object. These Request/Response objects are containers that exist in the SOAP messages.
I believe they are normally abstracted away but I may be mistaken.
answered Sep 29, 2010 at 2:15
-
Thanks for the reply, but I don't see my User object inside the GetUserResponse. Update: Forget that last comment, found it xDFelix Martinez– Felix Martinez2010年09月29日 04:35:21 +00:00Commented Sep 29, 2010 at 4:35
lang-cs