I will try to describe my problem. I have a method in a proxy class(auto-generated by wsdl) that accepts as its first argument an object of Type BaseType.I try to pass an inherited type and i get
The type xyz was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically
After searching for a lot of time i read about namespacing and about the xmlinclude attribute.So initially i had
/// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="esDatabaseServersSoap", Namespace="http://smbsaas/foo/bar")] [System.Xml.Serialization.XmlIncludeAttribute(typeof(SomeOtherType))]
public partial class esDatabaseServers : Microsoft.Web.Services3.WebServicesClientProtocol { private System.Threading.SendOrPostCallback GetRawSqlDatabasesPagedOperationCompleted; ................................................
................................................
public int AddSqlDatabase(BaseClass item, string groupName) {
and then i tried to add
[System.Web.Services.WebServiceBindingAttribute(Name="esDatabaseServersSoap", Namespace="http://smbsaas/foo/bar")] [System.Xml.Serialization.XmlIncludeAttribute(typeof(SomeOtherType))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(MyInheritedType))] i added this line
public partial class esDatabaseServers :
i got
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in the XML document. ---> System.InvalidOperationException: The specified type was not recognized: name='MyInheritedType', namespace="http://smbsaas/foo/bar", at .
MyInheritedType inherits from baseClass.
I really don't know what to do.Any ideas please? Thanks!