wse3 inherited class type not accepted as method parameter RRS feed

  • Question

  • 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!

    ps:I have posted the exact post in

    ps2:I tried to post it in archived forums(asmx related).sorry if this is not the correct but the technology is obsolete anyway.
    • Edited by tasoss Wednesday, October 1, 2014 3:01 PM forums choice reasoning
    • Moved by Fred Bao Thursday, October 9, 2014 7:23 AM Not a .net framework issue
    Wednesday, October 1, 2014 3:00 PM

All replies

  • Hi,

    This forum is to discuss .NET Framework issue. This issue is related to ASMX, I would suggest you post on the forum below,

    Where you can contact many experts about this topic,

    Thanks for your understanding!

    Jimmy Yang

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 2, 2014 3:16 AM
  • Thank you!
    Thursday, October 2, 2014 5:42 AM