Accessing Overloaded methods when Consuming an Object via a Web Reference

R

recoil

When consuming a Web Service via a Web Reference I have a class that
overrides the ToString method. The ToString then returns a custom
friendly string representation of the object. This works fine when the
control is consumed directly however when the object is consumed via a
web reference in a project the overriden ToString method is not called.

public class p
{
public override string ToString()
{
return "";
}
}

If this object is added to a Combo Box directly the object shows "" as
the text. If this is done via a Web Reference it shows Namespace.Type.

Am I missing something.
 
B

Brock Allen

Am I missing something.

Not to go on a tirade or anything, but web services aren't meant to be used
this way. Web services are about sending XML messages across the network
for interop purposes with other technology platforms (think java to .NET
for example). Web Services are not about distributed objects. The reason
many people get this incorrect impression is because the framework you're
using to build web services (specifically .NET) hides to details and never
explains the proper usage model. In short, the framework's too good at its
job at hiding those details. You must approach the framework realizing that
working with classes and objects is simply a convenience in your development
environment. It's a convenience that abstracts the reality of XML, SOAP,
XSD, WSDL and HTTP. So, use the framework, but realize that web services
aren't classes and all the things you know and love about them.
 
R

recoil

Yeah. I sort of realized it a bit after I posted it. (Well I realized
why it was not doing what I expected it to do).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top