Hi,
I have the following ws method...
[WebMethod]
public Class1 GetClass1()
{
return new Class1();
}
Class1 looks like....
public class Class1
{
protected string _prop;
public string Prop
{
get { return _prop; }
set { _prop = value; }
}
public void Test(string s)
{
// do some stuff
}
}
When I look at the returned instance of Class1 I can see the public property
but not the method.
Can anyone tell me what I am doing wrong. The client is a aspx page using
a regular .net 2.0 web reference.
Thanks
Manish Bafna - 28 Mar 2007 03:00 GMT
Hi,
try this code:
[WebMethod]
[XmlInclude(typeof(Class1))]
public Class1 GetClass1()
{
return new Class1();
}
You will need to add using System.Xml.Serialization; to your using section .
Hope this helps.

Signature
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
> Hi,
>
[quoted text clipped - 30 lines]
>
> Thanks
Manish Bafna - 28 Mar 2007 05:18 GMT
Hi,
Actually [XmlInclude(typeof(Class1))] will come before class:
[XmlInclude(typeof(Class1))]
public class Class1
{
protected string _prop;
public string Prop
{
get { return _prop; }
set { _prop = value; }
}
public void Test(string s)
{
// do some stuff
}
}
Hope this helps

Signature
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
> Hi,
>
[quoted text clipped - 30 lines]
>
> Thanks
WG - 28 Mar 2007 22:08 GMT
Thanks for your reply Manish. I tried this and now get a stack overflow when
the ws is called.
> Hi,
> Actually [XmlInclude(typeof(Class1))] will come before class:
[quoted text clipped - 50 lines]
> >
> > Thanks
Manish Bafna - 29 Mar 2007 07:48 GMT
Hi,
Actually you need to serialize the class in proper way and then also need to
deserialize the class at the client side where web service is consumed.Please
do google on how to serialize/deserialize the class and you will find further
samples/code snippets.
Hope this hepls

Signature
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
> Thanks for your reply Manish. I tried this and now get a stack overflow when
> the ws is called.
[quoted text clipped - 53 lines]
> > >
> > > Thanks
WG - 30 Mar 2007 17:34 GMT
Thanks Manish.
> Hi,
> Actually you need to serialize the class in proper way and then also need to
[quoted text clipped - 60 lines]
> > > >
> > > > Thanks