I want to use typed parameters in the web methods. But when visual studio 2005 creates the web reference on for the client it automatically creates it’s own types. I am using a .net web service and a .net client.
For example:
< WebMethod > _ Public Function Foo() as ServerNamespace.Bar … End Function
at the client the method becomes WebServiceInstance.Foo() as ClientNamespace.Webservice.Bar
returning a different type.
I started writing my own serialization helper class to convert the type, but I would have thought there would be a better way….
If you can upgrade to .Net 3.0, I would suggest switching to WCF for your client proxy. Svcutil.exe is the tool to generate a WCF client proxy from the web service; it has an option /reference, which takes an assembly and reuses any shared types from it. (I would also suggest switchnig the service to WCF if it’s under your control :-))
If you can’t upgrade, wsdl.exe has an option /sharetypes which might help you, although I am not sure how to do it exactly.