I made my own class, MyCompany.MyClass and I want to send one object of
this class from my webservice to the client.
On the client side, when I Update Web Reference, the object is known as
ProjectName.localhost.MyClass and not MyCompany.MyClass and the C# code
cannot cast from one to the other.
I can manually go into Reference.cs and tell the client side to expect
MyCompany.MyClass, but each time I do an Update Web Reference, my
manual change is wiped out (as expected).
Is there some attribute, flag, configuration setting I need to set in
order for the client to expect the correct class?
Thanks.
Pablo Cibraro [MVP] - 31 Jul 2006 15:12 GMT
No, VS or the wsdl.exe tool always create a new class from the type exposed
in the WSDL. (The class used as parameter in the web service, in your case,
MyCompany.MyClass). That happens because the web service can be implemented
in any platform, not only .NET.
Anyway, both classes represent the same XML, so if you use the generated
class in the client, the service will receive a MyCompany.MyClass instance.
(.NET performs the XML serialization and derialization for you, that process
is completely transparent).
In that way, the client application and the web service are loose-coupled by
types.
Your client application should use that generated class and not the original
one (MyCompany.MyClass) in order to consume any web service with the same
WSDL.
Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax
>I made my own class, MyCompany.MyClass and I want to send one object of
> this class from my webservice to the client.
[quoted text clipped - 11 lines]
>
> Thanks.