web service serialisation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • azadur
    New Member
    • Oct 2007
    • 5

    #1

    web service serialisation

    hi all,
    hope you can help.
    im writing some webservice to retireve data from a db(sql server)
    ive create some objects to encapsulate the data.
    the classes have been set as serializable.
    from my webservice, i can get a single object or a collection of objects back.
    the problem i am having is that the service wont return back collections of object within a class.

    e.g

    class item
    property a
    property b
    end class

    class items

    property name

    property items as item()

    end class

    in such a scenario where the items class contains a collection of item, i only get back the property name for example but not the collection.

    they are all declared as public
    i tried the items with readonly and read/write.
    any pointer would be greatly appreciated.

    many thanks in advance.
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Originally posted by azadur
    hi all,
    hope you can help.
    im writing some webservice to retireve data from a db(sql server)
    ive create some objects to encapsulate the data.
    the classes have been set as serializable.
    from my webservice, i can get a single object or a collection of objects back.
    the problem i am having is that the service wont return back collections of object within a class.

    e.g

    class item
    property a
    property b
    end class

    class items

    property name

    property items as item()

    end class

    in such a scenario where the items class contains a collection of item, i only get back the property name for example but not the collection.

    they are all declared as public
    i tried the items with readonly and read/write.
    any pointer would be greatly appreciated.

    many thanks in advance.
    I don't understand your example, or why serialization has anything to do with it. If your method returns a collection of objects withing some kind of collection class why can you not access those multiple objects?

    Comment

    • azadur
      New Member
      • Oct 2007
      • 5

      #3
      Originally posted by RedSon
      I don't understand your example, or why serialization has anything to do with it. If your method returns a collection of objects withing some kind of collection class why can you not access those multiple objects?
      sorry, i was trying to keep it short.
      class1 has some public properties
      class2 inherits collectionbase. it has 2 public methods, add, remove to keep a collection of class1 objects

      i have a class3 which has come properties. it also has a property which is class2.
      when i return class3 from the ws, it only serialises the public properties in class3. it does ode serialise the collection of class2 objects
      i.e


      public property items as class2

      it is a serialisation problem, because i am looking for deep serialisation.

      so:

      class1
      public name

      class2:collecti onbase
      public add(o as class1)

      class3
      public value
      public items as class2


      my ws returns

      <value/>
      <value/>


      i would like(assume 1 object in the items)

      <value/>
      <items>
      <name />
      <items>
      <value/>

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by azadur
        sorry, i was trying to keep it short.
        class1 has some public properties
        class2 inherits collectionbase. it has 2 public methods, add, remove to keep a collection of class1 objects

        i have a class3 which has come properties. it also has a property which is class2.
        when i return class3 from the ws, it only serialises the public properties in class3. it does ode serialise the collection of class2 objects
        i.e


        public property items as class2

        it is a serialisation problem, because i am looking for deep serialisation.

        so:

        class1
        public name

        class2:collecti onbase
        public add(o as class1)

        class3
        public value
        public items as class2


        my ws returns

        <value/>
        <value/>


        i would like(assume 1 object in the items)

        <value/>
        <items>
        <name />
        <items>
        <value/>
        Maybe you should post some code because I still have no idea what you are talking about.

        Comment

        Working...