Hello,
I have a simple webservice that accepts a network credential as an argument
to a webmethod.
When i create a proxy for my client to use, the proxy generator then
recreates a new type
mywebservicename.networkcredential
such that when i try to pass a system.net network credential to the
webservice, it fails saying option strict on prevents cast from
mywebservicename.networkcredential to system.net.networkcredential.
I prefer to program with Option strict on so i dont want to turn it off.
What am i doing wrong that .Net cant see that the network credentials are
exactly the same. This is especially annoying considering it is a .net
framework type i am passing.... but the proxy generator turns it into a
custom class... why?
I also get the same issue with a dataset created from the same middle tier
assembly, however whenever i try to pass the dataset from the client to the
webservice it says they are of different types?
Thanks
George
Elena Kharitidi - 02 Sep 2004 06:52 GMT
This behavior is by design: type identity is not preserved on the client,
otherwise strong coupling between server and client would be required.
Web services a lot about interoperability and it is essential for
interoperability that there are no assumptions are made about the
implementation or type system of a given Web Service.
WebService publishes its contract (service description) which describes the
message exchange and the wire signatures, but holds no details on the web
service implementation. In this particular case the
System.Net.NetworkCredential class will be described as a schema type with
three elements: UserName, Password and Domain, on the client side, when the
proxy is generated from the service description, again no assumption is
made about the web service implementation, and types declared in the wsdl
re-created on the client as a User defined types without any
business-object logic, with just one grantee: the serialized instances of
the created classes (wire signature) will validate against
service-published contract.