我正在使用 python zeep 库,我正在尝试向肥皂客户端发送请求,但我不断收到此错误:
ValueError:字符串类型不接受集合作为值
这是 WSDL 客户端的 XML 文件:
<s:element name="SendSms">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="to" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="from" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="text" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="isflash" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="udh" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="recId" type="tns:ArrayOfLong"/>
<s:element minOccurs="0" maxOccurs="1" name="status" type="s:base64Binary"/>
</s:sequence>
</s:complexType>
</s:element>
这是我的代码:
from zeep import Client
client = Client("http://www.parandsms.ir/post/send.asmx?wsdl")
parameters = {
"username":"my_user_name",
"password":"my_password",
"from":"50009666096096",
"to":"a_phone_number_wich_i_put_here_as_string",
"text":"salam",
"isflash":False,
'recId':"",
}
res = Client
status = 0
status= client.service.SendSms(parameters).SendSmsResult()
print(status)
我被这个错误困扰了很长时间。如果有人可以提供帮助,我将不胜感激。