WCF proxy client generated with wsdl not matching for ServiceContract, XmlSerializerFormat attributes

wcfwcf-client

I am developing WCF services in .net 3.5 framework and hosting them in IIS 5.1 windows xp sp3 with basicHttpBiding.

Services consuming client developed in .net 2.0 framework. For this I generated proxy client using WSDL.EXE. This tool generates proxy class without any problem, but the problem it adds for every property adds extra property "[property]Specified", but that work fine without any problem, only need to specify "specified = true" when assigning value to any property

To remove this extra property I added XmlSerializerFormat attribe along with ServiceContract attribute. WSDL.EXE generates the class without extra property, but it excludes some class which are included previously.

Is there any properties that I need to set to generate the excluded classes?

Note: All contract classes are attributed with DataContract and properties with DataMemeber.

nRk

Best Answer

XmlSerializer uses XmlIncludeAttribute instead of KnownTypeAttribute to discover child types that are not included in operation contracts. So you might try adding them to the base class:

[XmlInclude(typeof(ChildClass1))]
[XmlInclude(typeof(ChildClass2))]
public class BaseClass {}