Hi,
I have a simple web service with a method having a custom type as a parameter.
This type is declared in different namespace in other assembly.
Something like that:
public int Method1( Assembly1.Namespace1.Type1 parameter )
But in my client application the type of the parameter is changed. It regognizes it as
declared in the web service namespace ( WebServiceNamespace.Type1 )
Is there any way to solve that problem.
Thanks in Advance!
Kostadin

Web Service changes my parameter type
Prabagarane
Thanks Peter,
My problem is different. I don't want the wsdl to generates this new types because I can't cast them to the original types ( those in the Assembly i reference both in the service and the client ) and the scheme doesn't help. I need to pass parameter of type Assembly1.Namespace1.Type1 in the client to the service but the compiler tell's me that this type cannot be converted to WebServicesNamespace.Type1. In the generated proxy I need the statement using Assembly1.Namespace1 Instead of the generated class declaration .
gmaenrile
When you add a web reference to a project it downloads the WSDL and generates new types based on the schema of the service. No code is actually downloaded from the server, so there's no way to get the assemblies that implement the same types; so, you get different types (basically structures; actually).
You'd have to implement a Schema Provider and/or custom serialization. Unfortunately, the current version of VS2005 this means not using the Add Web Reference wizards (I believe they don't fully support schema providers or custom serialization) and using the XSD console application. A recent MSDN article Enrich Your XML Serialization With Schema Providers In The .NET Framework discusses this.
Jamie Thomson
Right. The schema defines the data structures used by the web service, not the types. You can link to other schemas for other data structures; but you can't directly link to .NET types (unless they're built-in types link int, or long).
What you want to do is map those WSDL (the schema for the web service) types to local types on the machine that's importing the WSDL. The only way to do this is use a schema provider to do the mapping to non-generated types. The provider basically gets informed of each namespace and has the option of generating code to suppor the types in that namespace. If you have a type that either supports a namsespace or can serialize with the same XML elements then your provider can generate that code.