0

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
2
  • 2
    You 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. Commented 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 :) Commented Oct 2, 2010 at 23:14

1 Answer 1

2

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
1
  • Thanks for the reply, but I don't see my User object inside the GetUserResponse. Update: Forget that last comment, found it xD Commented Sep 29, 2010 at 4:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.