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

时间:2013-03-21 09:43:11

标签: python web-services soap python-2.7 soap-client

我想通过soappy访问我的互联网服务提供商的网络服务。

这是一个来自Soap服务提供商的PHP示例: 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>

1 个答案:

答案 0 :(得分:0)

方法的第一个参数必须是消息名称,第二个参数是Dict及其所有参数......