0
我有这样的服务:Spyne:1以上的整数的数组
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)
不适用于我。
这是否意味着@rpc(Mandatory.Unicode,数组(Unicode,默认='*'),数组(Unicode),数组(Unicode),数组(Unicode) ,_returns = ProductWithRelations)def get_product_by_sku(ctx,product_sku,include_columns,exclude_columns,include_relationships,exclude_relationships):'可以安全地重写为'@rpc(Mandatory.Unicode,Unicode(max_occurs ='unbounded',default ='*'), Unicode(max_occurs ='unbounded'),Unicode(max_occurs ='unbounded'),Unicode(max_occurs ='unbounded'),_returns = ProductWithRelations)'? – warvariuc
恩,不,你在第一个阵列中有4个阵列,在第二个阵列中有4个阵列。另外,由Array(...)和Unicode生成的wsdl(max_occurs ='unbounded')是不同的。 –
但看起来像第二种形式很好:' < xs:sequence>' –
warvariuc