When my web service returns a custom object (containing only four strings, three ints and a bool) it takes several seconds (4-8seconds). When the same server sends the same information in a string it goes almost instantly.
The custom object class is defined in the same web service if that matters.
I didnt think it would make that much of a difference, or did I miss something fundamental here?
Edit: Some code, I removed some of the variables for easier reading.
Custom class defined in the web service:
public class AddressSearchResult
{
public AddressSearchResult()
{
Address = String.Empty;
Country = String.Empty;
}
public AddressSearchResult(string address, string country)
{
Address = address;
Country = country;
}
public string Address { get; set; }
public string Country { get; set; }
}
Only difference between the two WebMethods on the web service is the return statement:
WebMethod1 returning the obj
return new AddressSearchResult((string)address["address"], (string)address["country"]);
WebMethod2 returning only a string (Just to show I'm doing the same thing here)
return new AddressSearchResult((string)address["address"], (string)address["country"]).Address;
Receiving side, the console app:
AddressSearchResult result = adrSerWS.method1("example", "yehaa"); //THIS IS SLOW
string result2 = adrSerWS.method2("example", "yehaa"); //THIS IS FAST