Jack said:
I'm trying to consume a web service that returns some custom types. I'm
getting the error "[web reference].[object] cannot be converted to
[custom assembly].[object]". I was able to make it work by overriding
some definitions in a windows application, but I'm not able to get it to
work consuming the web service from asp.net.
You cannot cast to the custom type in your client. The custom type does
not exist in your client, only on the server.
1) The server creates an instance of some custom type
2) The server sends such an instance in a response
3) ASP.NET serializes that instance into XML
4) Your client receives that XML and deserializes it
The XML is deserialzed into some classes which .NET created for you. They
were created only as a convenience to you. They keep you from having to
access web service results as XML.
These classes are able to deserialize the XML which the web service WSDL
claims the web service will send.
If your web reference was created by referencing
http://host/service.asmx?WSDL, then the WSDL is one generated by ASP.NET.
It contains XML schema definitions. These are the definitions of the XML
into which the web service will serialize its results.
So, there are several layers between you and the custom type the web
service is returning.
If you actually need to use the custom type on the client (for instance,
if you need to call methods on that type), then you need to use .NET
Remoting, not web services.
John