@@ -0,0 +1,2942 @@
+#!/usr/bin/env python%0A# encoding: utf8%0A#%0A# Copyright %C2%A9 Burak Arslan %3Cburak at arskom dot com dot tr%3E,%0A#             Arskom Ltd. http://www.arskom.com.tr%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions are met:%0A#%0A#    1. Redistributions of source code must retain the above copyright notice,%0A#       this list of conditions and the following disclaimer.%0A#    2. Redistributions in binary form must reproduce the above copyright%0A#       notice, this list of conditions and the following disclaimer in the%0A#       documentation and/or other materials provided with the distribution.%0A#    3. Neither the name of the owner nor the names of its contributors may be%0A#       used to endorse or promote products derived from this software without%0A#       specific prior written permission.%0A#%0A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT,%0A# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,%0A# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY%0A# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING%0A# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,%0A# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A#%0A%0Afrom __future__ import absolute_import%0A%0Aimport sys%0A%0Afrom spyne import ComplexModel, Unicode, Integer, Array, TTableModel, rpc, %5C%0A    Application, ServiceBase%0Afrom spyne.protocol.soap import Soap11%0Afrom spyne.server.wsgi import WsgiApplication%0Afrom spyne.util.cherry import cherry_graft_and_start%0A%0ATableModel = TTableModel()%0A%0A%0Aclass Vehicle(ComplexModel):%0A    _type_info = %5B%0A        ('owner', Unicode),%0A    %5D%0A%0A%0Aclass Car(Vehicle):%0A    _type_info = %5B%0A        ('color', Unicode),%0A        ('speed', Integer),%0A    %5D%0A%0A%0Aclass Bike(Vehicle):%0A    _type_info = %5B%0A        ('size', Integer),%0A    %5D%0A%0A%0Aclass Garage(ComplexModel):%0A    _type_info = %5B%0A        ('vehicles', Array(Vehicle)),%0A    %5D%0A%0A%0Aclass SomeService(ServiceBase):%0A    @rpc(_returns=Garage)%0A    def get_garage_dump(self):%0A        return Garage(%0A            vehicles=%5B%0A                Car(%0A                    color=%22blue%22,%0A                    speed=100,%0A                    owner=%22Simba%22%0A                ),%0A                Bike(%0A                    size=58,%0A                    owner=%22Nala%22%0A                ),%0A            %5D%0A        )%0A%0Aapplication = Application(%5BSomeService%5D, 'tns',%0A    in_protocol=Soap11(validator='lxml'),%0A    out_protocol=Soap11(polymorphic=True)%0A)%0A%0Asys.exit(cherry_graft_and_start(WsgiApplication(application)))%0A

add polymorphic array example