关于python客户端操作wdsl时ns4:ArrayOfString的值该怎么传入

blackfriday13 2018-01-26 01:24:26
aSP里
gatewayId = Client.Sms.SendMessage3(Array("1手机号0"), "asp测试", "5", "用户名", "密码")
php里
gatewayId = Client.Sms.SendMessage3(Array("1手机号0"), "asp测试", "5", "用户名", "密码")


python里没有好像没有array()函数,不知道该怎么传入
arr=['1手机号']
把arr,arr[0]传进去不行,
import array
arr=['b','15088256320'],arr=array.array('i',[1,手机号,0])
arr=array.array('B','1手机号0')都不行

the formatter throw out an exception while tring to desiraliza the message, destinationAddress

引用
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913

Service ( MmsImplementation ) tns="http://tempuri.org/"
Prefixes (5)
ns0 = "http://openmas.chinamobile.com/mms"
ns1 = "http://schemas.datacontract.org/2004/07/OpenMas"
ns2 = "http://schemas.datacontract.org/2004/07/System"
ns3 = "http://schemas.microsoft.com/2003/10/Serialization/"
ns4 = "http://schemas.microsoft.com/2003/10/Serialization/Arrays"
Ports (1):
(BasicHttpBinding_IMms)
Methods (6):
AddTask3(ns1:PeriodType periodType, ns1:PeriodValue periodValue, ns1:PeriodTime periodTime, ns4:ArrayOfstring destinationAddresses, xs:string subject, xs:string content, xs:string extendCode, xs:string applicationId, xs:string password, )
AddTask4(ns1:PeriodType periodType, ns1:PeriodValue periodValue, ns1:PeriodTime periodTime, ns4:ArrayOfstring destinationAddresses, xs:string subject, xs:string content, xs:string extendCode, xs:string applicationId, xs:string password, xs:dateTime beginTime, xs:dateTime endTime, )
GetMessage(xs:string messageId, )
RemoveTask(xs:string taskId, )
SendMessage3(ns4:ArrayOfstring destinationAddresses, xs:string subject, xs:string content, xs:string extendCode, xs:string applicationId, xs:string password, )
SendMessage4(ns4:ArrayOfstring destinationAddresses, xs:string subject, xs:string content, xs:string extendCode, xs:string applicationId, xs:string password, xs:dateTime expectSendTime, )
Types (10):
ns4:ArrayOfstring
ns2:DayOfWeek
ns1:MmsMessage
ns1:PeriodTime
ns1:PeriodType
ns1:PeriodValue
ns1:Priority
ns3:char
ns3:duration
ns3:guid

suds.WebFault: Server raised fault: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter

...全文
950 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 11 楼 blackfriday13 的回复:
是的。是用来openmas发邮件的,是web services, wsdl服务。 如果是py3的话,可能是要pip install suds-py3来安装suds。 SendMessage3 应该是wsdl接口的
非常感谢,方便加下wx吗?m1131909224
blackfriday13 2019-02-28
  • 打赏
  • 举报
回复
是的。是用来openmas发邮件的,是web services, wsdl服务。 如果是py3的话,可能是要pip install suds-py3来安装suds。 SendMessage3 应该是wsdl接口的
  • 打赏
  • 举报
回复
谢谢博主,我下载了suds包的源码,并没有发现 SendMessage3 方法,所以用户名、密码是这个函数的后两个参数吗?博主这个程序也是用于通过 OpenMAS 平台发送短信是吗? 我的suds版本是 pip freeze | grep -i "suds" suds==0.4
blackfriday13 2019-02-21
  • 打赏
  • 举报
回复
smsm.py

import sys
import suds
from suds.client import Client
url='http://    :9080/OpenMasService?wsdl'
c=Client(url)

def sms(phonenumber,text):
    d=c.factory.create('ns4:ArrayOfstring')
    d.string=[phonenumber]
    j=c.service.SendMessage3(d,text,'8','    ','  ')

    
if __name__=='__main__':
    if len(sys.argv)!=3:
        print ('Usage:python need 2 string')
        exit(1)
    phonenumber=sys.argv[1]
    text=sys.argv[2]
    
    sms(phonenumber,text)
主调用文件

import smsm
smsm.sms('15088908890',’thank you for testinng this code')
python3可支持中文发送,python2可能只支持英文
  • 打赏
  • 举报
回复
楼主方便分享下python版的完整示例代码?谢谢!
blackfriday13 2018-02-06
  • 打赏
  • 举报
回复
自己在网上搜索了一番,再尝试之后,应该已经解决了 d=c.factory.create('ns4:ArrayOfstring') d.string=['1手机号0'] 再把d作为参数传入
blackfriday13 2018-01-27
  • 打赏
  • 举报
回复
http://blog.csdn.net/feixuedongji/article/details/46422517 看到这么一边文章,不过没看懂
陈年椰子 2018-01-26
  • 打赏
  • 举报
回复
$cars=array("Volvo","BMW","Toyota");
cars=["Volvo","BMW","Toyota"]
陈年椰子 2018-01-26
  • 打赏
  • 举报
回复
把相关代码及出错信息帖一下。 如果是数组的问题, python 这方面应该很强大。
blackfriday13 2018-01-26
  • 打赏
  • 举报
回复
引用 1 楼 seakingx 的回复:
没看明白要做啥。 意思是传数组里的数组吗? arr = [['手机号码1']]
append list not-valid
blackfriday13 2018-01-26
  • 打赏
  • 举报
回复
引用 1 楼 seakingx 的回复:
没看明白要做啥。 意思是传数组里的数组吗? arr = [['手机号码1']]
引用 1 楼 seakingx 的回复:
没看明白要做啥。 意思是传数组里的数组吗? arr = [['手机号码1']]
引用 1 楼 seakingx 的回复:
没看明白要做啥。 意思是传数组里的数组吗? arr = [['手机号码1']]
是的,要传数据进去,总是提示格式不对
陈年椰子 2018-01-26
  • 打赏
  • 举报
回复
没看明白要做啥。 意思是传数组里的数组吗? arr = [['手机号码1']]

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧