python调用suds方法,抛出对象实例没有设置的错误,为什么?我的python2.6安装了setuptools 和 suds,连接一
python调用suds方法,抛出"对象实例没有设置"的错误,为什么?
我的python2.6安装了setuptools 和 suds,连接一个soap服务器没有问题,获得方法也没有问题。
问题是在调用方法的时候出错了,抛出了异常。
代码如下:
Python codeurl="http://......WSDL"client=Client(url)print(client)#可以打印出一堆wsdl里面的信息,包括所有的方法名称ID="123"Name=""def hello(id,name): print(id,name)hello(ID,Name)print(client.service.retrieveMy) #打印<suds.client.Method instance at 0x01CB4D28>print(client.service.retrieveMy(ID,Name))#出错了
在Python的IDE里面打印出错误信息:
Traceback (most recent call last):
File "D:\my.py", line 23, in <module>
print(client.service.retrieveMy(ID,Name))
File "build\bdist.win32\egg\suds\client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "build\bdist.win32\egg\suds\client.py", line 602, in invoke
result = self.send(soapenv)
File "build\bdist.win32\egg\suds\client.py", line 649, in send
result = self.failed(binding, e)
File "build\bdist.win32\egg\suds\client.py", line 702, in failed
r, p = binding.get_fault(reply)
File "build\bdist.win32\egg\suds\bindings\binding.py", line 265, in get_fault
raise WebFault(p, faultroot)
WebFault: Server raised fault: 'Server was unable to process request. ---> Object reference not set to an instance of an object.'
这到底是什么错误呢?
[解决办法]参数个数指定的不正确。