Object Serialization

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    Object Serialization

    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.c om/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.

  • Ingo Eichenseher

    #2
    Re: Object Serialization

    Hi

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

    Ingo


    Comment

    • Champika Nirosh

      #3
      Re: Object Serialization

      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.

      "Ingo Eichenseher" <Mister_I@gmx.d e> wrote in message
      news:eZDvkFvSFH A.1404@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hi
      >
      > i think only public properties with get _and_ set methods
      > will be serialized.
      >
      > Ingo
      >
      >[/color]


      Comment

      Working...