我有这项服务:
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_path
参数是一个包含1个或更多整数的数组,但Array(Integer(min_occurs=1, max_occurs='unbounded', nillable=False)
对我不起作用。
答案 0 :(得分:1)
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):
# (...)