Base class members are not exposed in Excel using Web Service

Y

YoJ

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top