|
-
January 27th, 2009, 12:29 PM
#1
Serialising Custom Objects ASP Webservice
Hey,
I asked a similar question a while back but never got a response...
Ive got a problem where i have a web method (like shown below)
Code:
// Class Example
public CustomClass
{
protected int Var1 = 10;
protected String Var2 = "Example";
public int IntVar { get { return Var1; } }
public String StringVar { get { return Var2; } }
}
// Web Method Example
[WebMethod]
CustomClass GetClass()
{ return new CustomClass(); }
// Example Output
<CustomClass>
<IntVar>10</IntVar>
</CustomClass>
Now thats a simple example, you call the method and get back a custom class, now if i view that method in the browser i see the object in XML but its missing alot of the content of the class, it only seems to display the int values and none of the Strings, even though each member has a public property assigned.
Is there some sort of attribute that needs to be applied to have control over how the XML serialises the object for returning?
Any advice would be great! (Again just want to point out that this is a VERY simple example of what my problem is, not point pasting reams of code in here, when that should be enough)
Last edited by Grofit; January 27th, 2009 at 12:32 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|