Python Spyne:一个或多个整数的数组

Python Spyne:一个或多个整数的数组,python,soap,wsdl,spyne,Python,Soap,Wsdl,Spyne,我有以下服务: class CategoryService(ServiceBase): @rpc(Array(Integer(min_occurs=1, max_occurs='unbounded', nillable=False), **MANDATORY), _returns=Iterable(Category, **MANDATORY)) def get_subcategories_by_path(ctx, category_path):

我有以下服务:

class CategoryService(ServiceBase):

    @rpc(Array(Integer(min_occurs=1, max_occurs='unbounded', nillable=False), **MANDATORY),
         _returns=Iterable(Category, **MANDATORY))
    def get_subcategories_by_path(ctx, category_path):
        ...
这在WSDL中显示为:

<xs:complexType name="get_subcategories_by_path">
  <xs:sequence>
    <xs:element name="category_path" type="tns:integerArray"/>
  </xs:sequence>
</xs:complexType>
<xs:complexType name="integerArray">
  <xs:sequence>
    <xs:element name="integer" type="xs:integer" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </xs:sequence>
</xs:complexType>


我希望
category\u path
参数是一个由1个或多个整数组成的数组,但是
array(Integer(min\u occurs=1,max\u occurs='unbounded',nillable=False)
对我不起作用。

array
用于包装数组类型。要获得简单的类型,应该直接使用类型标记。以下方法可以做到:

class CategoryService(ServiceBase):
    @rpc(Integer(min_occurs=1, max_occurs='unbounded', nillable=False)),
                                        _returns=Iterable(Category, **MANDATORY))
    def get_subcategories_by_path(ctx, category_path):
        # (...)

这是否意味着
@rpc(Mandatory.Unicode、Array(Unicode、default='*')、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode)、Array(Unicode),\u returns=ProductWithRelations)des=ProductWithRelations)ded(ctx、product\u sku、include\u列、exclude\(Mandatory.Unicode,Unicode(max_ocurs='unbounded',default='unbounded')、Unicode(max_ocurs='unbounded')、Unicode(max_ocurs='unbounded')、Unicode(max_ocurs='unbounded')、_returns=ProductWithRelations)
?不,第一个数组中有4个数组,第二个数组中有一个数组。另外,数组(…)和Unicode(max_ocurs='unbounded')生成的wsdl是不同的。但是看起来第二种形式很好:
好吧,如果它看起来很好,python端不会有任何变化。两者都将反序列化为指定类型的数组。