2014-09-30 104 views
0

我将尝试描述我的问题。 我有一个代理类的方法(自动产生由WSDL),其接受作为第一个参数类型BaseType.I的目的试图通过继承的类型和我得到wse3继承的类类型不被接受为方法参数

是没有预料到的类型的xyz 。使用XmlInclude或SoapInclude属性来指定不是静态

知名搜索了大量的时间后类型我也读到了命名空间以及有关xmlinclude attribute.So最初我有

/// [System.CodeDom.Compiler.GeneratedCodeAttribute( “WSDL”, “2.0.50727.3038”)] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute( “代码”)] [System.Web程序。 Services.WebServiceBindingAttribute(Name =“esDatabaseServersSoap”,Namespace =“http:// smbsaas/foo/bar”)] [System.Xml.Serialization.XmlIncludeAttribute(typeof运算(SomeOtherType))]
公共部分类esDatabaseServers:Microsoft.Web.Services3.WebServicesClientProtocol { 私人System.Threading.SendOrPostCallback GetRawSqlDatabasesPagedOperationCompleted; ................................................
................................................
公众诠释AddSqlDatabase(BaseClass的项,串组名){

,然后我尝试添加

[System.Web.Services.WebServiceBindingAttribute(名称= “esDatabaseServersSoap”,命名空间=” http:// smbsaas/foo/bar“)] [System.Xml.Serialization.XmlIncludeAttribute(typeof(SomeOtherType))] [Syst em.Xml.Serialization.XmlIncludeAttribute(typeof运算(MyInheritedType))] 我增加这一行
公共部分类esDatabaseServers:

我得到

的System.Web。 Services.Protocols.SoapException:System.Web.Services.Protocols.SoapException:服务器无法读取请求。 ---> System.InvalidOperationException:XML文档中存在错误。 ---> System.InvalidOperationException:指定的类型未被识别:name ='MyInheritedType',namespace =“http:// smbsaas/foo/bar”,at。

MyInheritedType继承自baseClass。

我真的不知道该怎么办。请给点意见吗? 谢谢!

回答

0

你有没有试图把XmlInclude属性的基类 - 在这篇文章中提到:Web services - XmlInclude in a derived class instead of a base class?

但是只有在你自己的Web服务,这将是有益的。

如果只是针对某些增强功能(可能不是您的情况),则可以尝试使用部分类。

+0

我把它放在错误的位置......谢谢。 – tasoss 2014-10-22 08:08:00