ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Base class members are not exposed in Excel using Web Service (https://www.excelbanter.com/excel-programming/382149-base-class-members-not-exposed-excel-using-web-service.html)

YoJ

Base class members are not exposed in Excel using Web Service
 
Hi,

I am trying to reference a web service from Excel using Office 2003 Web
Service Toolkit and I have the following objects defined:

[Serializable()]
public class BaseClass
{
private int id;

public int ID
{
get { return id; }
set { id = value; }
}
}

[Serializable()]
public class InheritedClass : BaseClass
{
private int attribute;

public int Attribute
{
get { return attribute; }
set { attribute = value; }
}
}

and I have the following method defined in the web service:

[WebMethod( Description = "description", MessageName = "GetAttribute" )]
[XmlInclude( typeof( BaseClass ) )]
public string GetAttribute( InheritedClass test )
{
return test.Attribute;
}

When my web service is referenced in the Excel, it generates a structure
called "struct_InheritedClass" with "Attribute" property but it does not
contain base class property "ID".

How can I expose members of base class in the structure of inherited class?
Shouldn't the Web Service Toolkit also generate a structure for base class
as well?

Any help would be appreciated.
Thanks.


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com