all groups > dotnet web services > april 2005 >
You're in the

dotnet web services

group:

Object Serialization



Object Serialization Brian
4/26/2005 10:23:09 AM
dotnet web services: Hi,

I'm a newbie to XML Web Services I have a class written in C# with a few
string properties that i want to expose as xml from a web service.

Whenever i try this i just get something like this:

<?xml version="1.0" encoding="utf-8" ?>
<CLASSNAME xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.namespace.com/Webservices/" />

None of the properties are visible.

How do i make it so the properties are xml nodes?

EG. the properties:

public string prop1
{
get { return "val1"}
}

public string prop2
{
get { return "val2"}
}


would be exposed as:

<prop1>val1</prop1>
<prop2>val2</prop2>


Thanks.
Re: Object Serialization Ingo Eichenseher
4/27/2005 12:00:00 AM
Hi

i think only public properties with get _and_ set methods
will be serialized.

Ingo

Re: Object Serialization Champika Nirosh
4/27/2005 12:00:00 AM
Indeed you are correct .. get method needed when serializing the object..
and set method needed when deserialize the object .... inorder to transfer a
data object successfully u need to have both methods implemented in your
data class...

Nirosh.

[quoted text, click to view]

AddThis Social Bookmark Button