2 Replies Latest reply on Nov 11, 2005 8:57 AM by bogsolomon

    Serializer results in stack overflow

    bogsolomon

      I have two objects pointing one to another. When the serializer tries to send one of the objects it keeps serializing ClassA and then ClassB recursively and gives a stackoverflow at one point.

        • 1. Re: Serializer results in stack overflow
          thomas.diesler

          With SOAP encoding you can have an ID attribute with SOAP encoded elements and use HREF that references them. With literal encoding this is not allowed.

          Jason wrote


          Literal bindings require the literal data be a 1 to 1 translation to valid schema (which has no native concept of representing a circular graph, and explicitly forbids them). If there is a need to represent circular data, then that is up to the developer to define custom elements or attributes in their schema to represent these link associations. So you could define something like

          However it is your responsibility to transform the id fields to an object reference.


           <xs:complexType name="employeeType">
           <xs:sequence>
           <xs:element name="id" type="xsd:int"/>
           <xs:element name="manager" type="xsd:int"/>
           </xs:sequence>
           </xs:complexType>
          


          Bottome line: it is not supported with ws4ee, which only allows literal encoding

          • 2. Re: Serializer results in stack overflow
            bogsolomon

            Thank you very much. I have solved the problem by creating a custom serializer that adds an ID to the object as an attribute and then when the same object is meant to be serialized again just creates it as null with two attributes specifying that it is a reference and the ID. Not really a portable solution but it works very nicely.