View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
YoJ YoJ is offline
external usenet poster
 
Posts: 1
Default 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.