tags:

views:

293

answers:

2

In SOA I believe that the wsdl does not support recursive data types but I saw some examples where the proxy actually works. Anybody knows more about this?

A: 

Please define what you mean by recursive. The following is a valid XML Schema for use in a WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Node" type="NodeType"/>
    <xs:complexType name="NodeType">
        <xs:sequence>
            <xs:element name="Node" type="NodeType"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
John Saunders
Let's say you have something like this:[DataContract]public class Tree{[DataMember] public Tree Left{get;set;}[DataMember]public Tree Right{get;set;[DataMember]public String Data{get;set;}}}
Neo Christo
Neo: that should work.
Anderson Imes
in SOA , isn't it true that recursive data types are not supported?
Neo Christo
@Neo: I've never heard that. If you can find a citation, please post it.
John Saunders
+1  A: 

Recursive type definitions are allowed and even cyclic object graphs are allowed and serializable. However, in order to keep from running out of stack space while serializing and deserializing, you'll need to create a custom behavior overriding the CreateSerializer method and setting the preserveObjectReferences parameter to true when its creating a DataContractSerializer. See James Kovacs' blog for more.

Travis Heseman
Thank you Travis, this is the answer that I was looking for. Very good blog indeed
Neo Christo