0
votes

I wanted to access with soappy a webservices of my internet provider.

here is a example in php from the provider of the Soap Services: http://kasapi.kasserver.com/dokumentation/?open=soap

but I am not getting smart, to get it to run in python. I always get this error message: "Cannot use object of type stdClass as array"

Any ideas how to solve that?! My program has 34 lines....

Here is the code:

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()

I got this error message:

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

1 Answers

0
votes

1st paramter of method MUST be the message name, 2nd parameter the Dict with all it's parameters......