次のような複合型を含む WSDL があります。
<xsd:complexType name="string_array">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
SOAP クライアントにzeepを使用することに決め、その型を WSDL で参照されている他のメソッドの 1 つへのパラメーターとして使用したいと考えています。しかし、このタイプの使い方がわかりません。WSDL で参照されている特定のデータ構造の使用方法に関するドキュメントを調べたところ、client.get_type()
メソッドを使用するように書かれているので、次のようにしました。
wsdl = "https://wsdl.location.com/?wsdl"
client = Client(wsdl=wsdl)
string_array = client.get_type('tns:string_array')
string_array('some value')
client.service.method(string_array)
これはエラーになりますTypeError: argument of type 'string_array' is not iterable
。私はまた、その多くのバリエーションを試し、次のような辞書を使用しようとしました:
client.service.method(param_name=['some value'])
エラーが発生する
ValueError: Error while create XML for complexType '{https://wsdl.location.com/?wsdl}string_array': Expected instance of type <class 'zeep.objects.string_array'>, received <class 'str'> instead.`
上記の型を WSDL から zeep で使用する方法を誰かが知っていれば、私は感謝します。ありがとう。