473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Can't see public method on object returned from web service

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

Mar 28 '07 #1
5 1970
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.
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
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
Mar 28 '07 #2
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
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
Mar 28 '07 #3
Thanks for your reply Manish. I tried this and now get a stack overflow when
the ws is called.
"Manish Bafna" wrote:
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
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
Mar 28 '07 #4
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
Thanks for your reply Manish. I tried this and now get a stack overflow when
the ws is called.
"Manish Bafna" wrote:
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
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
>
Mar 29 '07 #5
Thanks Manish.

"Manish Bafna" wrote:
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"WG" wrote:
Thanks for your reply Manish. I tried this and now get a stack overflow when
the ws is called.
"Manish Bafna" wrote:
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
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
>
>
>
"WG" wrote:
>
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
Mar 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jamus Sprinson | last post by:
Before I continue, I'm going to begin by saying I'm not by any means an expert- I've been using .NET with C# for about 4 months now, and basically just learning by example and docs. A game...
4
by: CaptRR | last post by:
I think this is the right group to post to, so here goes. My problem is this, I cannot update the datarow to save my life. Been on this for 2 days now, and still am no closer to figuring it out...
0
by: Mike | last post by:
Hi All, I am using a COM object and so I have to use a form for it to work. The problem is I need to run it as a service as well. When I run it in a test scenario everything works fine and...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
6
by: Jim S | last post by:
I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice that communicate on the same LAN. The Pocket PC has no problem consuming strings returned from the web service methoeds but...
4
by: Joseph Geretz | last post by:
I don't get it. A DataTable can't be returned, but a DataSet can. Yet a DataSet contains one or more DataTables. So obviously a DataTable must be serializable. So why not just let me return a...
5
by: David Palau | last post by:
I'm looking for some guidance on what data type would work best as the result output of a web service function method. This web method will return an object that implements a class that is...
4
by: Jonathan | last post by:
I have a SQL stored procedure for adding a new record in a transactions table. It also has two return values: CounterID and IDKey. I want to create a webservice that accepts the 10 input...
11
by: casucci | last post by:
I do a return as XMLDataDocument in my webservice but it returns not with the namespaces etc in them. Anyone have and example where I can have the webservice return it as a XML. C# preferred....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.