0

我想用肥皂访问我的互联网提供商的网络服务。

这是来自 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>
4

1 回答 1

0

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

于 2013-03-22T07:25:13.257 回答