我正在使用Python库zeep与SOAP服务进行通信。文档中必需的参数之一是List<String>
类型,在WSDL中,我发现了这一点:
<xs:element minOccurs="0" maxOccurs="1" name="IncludedLenders" type="tns:ArrayOfString"/>
我相信AraryOfString
的定义是:
<xs:complexType name="ArrayOfString">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
如何使zeep生成该值?我尝试过:
"IncludedLenders": [
"BMS",
"BME"
]
但是会生成:
<ns0:IncludedLenders>
<ns0:string>BMS</ns0:string>
</ns0:IncludedLenders>
代替:
<ns0:IncludedLenders>
<ns0:string>BMS</ns0:string>
<ns0:string>BME</ns0:string>
</ns0:IncludedLenders>
任何想法如何产生后代?
答案 0 :(得分:0)
我想通了。首先,我需要提取ArrayOfString
类型:
array_of_string_type = client.get_type("ns1:ArrayOfString")
然后以这种方式创建它:
"IncludedLenders": array_of_string_type(["BMS","BME"])