SOAP-ENV:服务器:不能使用stdClass类型的对象作为数组



我想用soap访问我的互联网提供商的web服务。

下面是php中Soap服务提供者的一个例子:http://kasapi.kasserver.com/dokumentation/?open=soap

但是我没有变聪明,让它在python中运行。我总是得到这个错误信息:"不能使用stdClass类型的对象作为数组"

有什么办法解决吗?我的程序有34行....

代码如下:

from SOAPpy import WSDL
from SOAPpy.Errors import HTTPError as SoapHTTPError
from SOAPpy.Types import faultType
import hashlib
from array import array
class KASSystem(object):
    def __init__(self):
        WSDL_AUTH = 'https://kasapi.kasserver.com/soap/wsdl/KasAuth.wsdl'
        WSDL_API = 'https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl'

        userpass = ['mylogin','mypassword']
        m = hashlib.sha1()
        m.update(userpass[1])
        userpass[1] = m.hexdigest()
        loginData = {'user':userpass[0],'pass':userpass[1]}
        self.__SoapServer = WSDL.Proxy(WSDL_AUTH)
        try:
            self.__CredentialToken = self.__SoapServer.KasAuth({
                'KasUser':loginData['user'],
                'KasAuthType':'sha1',
                'KasPassword':loginData['pass'],
                'SessionLifeTime':1800,'SessionUpdateLifeTime':'Y'})
        except (SoapHTTPError), e:
            print "Fehlermeldung:", e.code,e.msg
KasObj = KASSystem()

我得到了这个错误信息:

Traceback (most recent call last):
  File "/storage/PyProjects/toolsAPP/KASUpdate.py", line 33, in <module>
    KasObj = KASSystem()
  File "/storage/PyProjects/toolsAPP/KASUpdate.py", line 28, in __init__
    'SessionLifeTime':1800,'SessionUpdateLifeTime':'Y'})
  File "build/bdist.linux-x86_64/egg/SOAPpy/Client.py", line 540, in __call__
  File "build/bdist.linux-x86_64/egg/SOAPpy/Client.py", line 562, in __r_call
  File "build/bdist.linux-x86_64/egg/SOAPpy/Client.py", line 475, in __call
SOAPpy.Types.faultType: <Fault SOAP-ENV:Server: Cannot use object of type stdClass as array>

方法的第一个参数必须是消息名,第二个参数必须是包含所有参数的字典......

相关内容

  • 没有找到相关文章

最新更新