Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'skip:[ 20': 0.03; 'socket': 0.05; 'soap': 0.07; 'python': 0.09; 'behave': 0.09; 'happens.': 0.09; 'http,': 0.09; 'tcp/ip': 0.09; 'way:': 0.09; 'do,': 0.15; 'library': 0.15; "skip:' 30": 0.15; '24,': 0.16; 'also:': 0.16; 'dictionary,': 0.16; 'do).': 0.16; 'fluent': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hard-coded': 0.16; 'itself),': 0.16; 'oddly': 0.16; 'on"': 0.16; 'sha1': 0.16; 'skip:{ 30': 0.16; 'subject:array': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'try/except': 0.16; 'tuple,': 0.16; 'later': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'requests': 0.18; '(or': 0.18; 'load': 0.19; 'translate': 0.20; 'packaging': 0.20; 'assuming': 0.22; 'sends': 0.22; 'stick': 0.22; 'terminate': 0.22; "i'd": 0.22; "i've": 0.23; 'seems': 0.23; 'script': 0.24; 'testing': 0.24; 'least': 0.25; 'header:In-Reply- To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'initial': 0.28; 'helpful.': 0.29; 'prints': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'usually': 0.30; 'error': 0.30; 'on,': 0.30; 'stuff': 0.30; 'file': 0.32; "skip:' 20": 0.32; 'switch': 0.32; 'page.': 0.33; 'zero': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85.220': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'something': 0.35; 'add': 0.36; 'but': 0.36; "didn't": 0.36; "i'll": 0.36; 'should': 0.36; 'enough': 0.36; 'unable': 0.36; 'xml': 0.37; 'quite': 0.37; 'rather': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'google': 0.39; 'your': 0.60; 'easy': 0.60; 'save': 0.61; 'monitoring': 0.61; 'traffic': 0.61; "you'll": 0.62; 'between': 0.63; 'different': 0.63; 'information,': 0.63; 'here': 0.65; 'carried': 0.65; 'obvious': 0.71; 'yourself': 0.77; '2013': 0.84; 'around,': 0.84; 'fortunately': 0.84; 'suspicion': 0.84; 'megabytes': 0.91; 'subject:skip:S 20': 0.91; 'url:open': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=HroFwJ8UjLm44E6jBmB3OHbKYCNDpO6MobsMR3uTobk=; b=U13+WfisElyTxSuXTX+00APagRCr6EJGGXcT6a+Iuu/DqCBP6sIL4SMKM2NEV25NKw JdjdnzSsuCQ8vY1m9fTuLWsbmGe1x+eFD+MRB/T8vLTvYH70mOhCRKERPGFEn5wqn9Pq 1MQLzjayMWSmylSNrAJKpNCgk46GktujBG0yJt4VoPK4OU4AbInVZj3O07oMTSQnIGFX ldEFQVNdD8x0WFaafBcxIqw7YswhOhMyRKlZQPU5dwIThj/47EQ5SwlH2Zbs9I+NVn7p iGyE7p8XCxLq6ZDOHa/bgMbshfWCjWlGBz4q1cPeDO81S18y4OJuwDorIWlVx1CSu4LI RE3w== MIME-Version: 1.0 X-Received: by 10.52.67.164 with SMTP id o4mr6168228vdt.42.1364051037941; Sat, 23 Mar 2013 08:03:57 -0700 (PDT) In-Reply-To: <514DAF1D.50801@googlemail.com> References: <514A0898.4000807@googlemail.com> <514DAF1D.50801@googlemail.com> Date: Sun, 24 Mar 2013 02:03:57 +1100 Subject: Re: SOAPpy.Types.faultType: Cannot use object of type stdClass as array From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364051041 news.xs4all.nl 6930 [2001:888:2000:d::a6]:45709 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41736 On Sun, Mar 24, 2013 at 12:33 AM, Tamer Higazi wrote: > Hi Chris! > thanks.... But I am about of going nuts.... I did everything according > their sample: > > http://kasapi.kasserver.com/dokumentation/?open=soap Since I'm not fluent in German, I'm relying on Google Translate to read of that page. (I didn't find an obvious English version of the page, but maybe I just didn't look in the right place.) One thing I've found about the PHP SOAP library is that it seems to behave quite oddly in some circumstances - my suspicion is the WSDL file (eg when it's unable to load it). Try monitoring the actual traffic - SOAP is XML carried over HTTP, so you should be able to just snoop the TCP/IP socket (easiest way might be to switch in your own server). See if you can spot a difference between the request that PHP sends and the one your Python script sends. Fortunately you're not moving megabytes of data around, here - it should be easy enough to eyeball the requests and see what's different about them :) A tip, by the way: userpass = ['login','password'] m = hashlib.sha1() m.update(userpass[1]) userpass[1] = m.hexdigest() loginData = {'user':userpass[0],'pass':userpass[1]} 'KasUser':loginData['user'], 'KasPassword':loginData['pass'], You keep packaging and repackaging the credentials. I'm assuming you won't actually have them hard-coded like that (if you do, I would recommend hard-coding the SHA1 hash, rather than the password itself), so I'll stick with the userpass list (or tuple, which would work exactly the same way). password = hashlib.sha1(userpass[1]).hexdigest() ... 'KasUser':userpass[0], 'KasPassword':password, Or even inline that completely (which is what I'd probably do). There's no need to stuff it into a dictionary, only to pull it out again. Also: A try/except that just prints out the error message usually isn't helpful. Save yourself the trouble, at least during initial testing - just let the exception terminate your script. You'll get all the same information, plus the full traceback, and it's cost you exactly zero development time :) Later on, you can add try/except if you need to do something other than terminate, but often that "later on" never even happens. ChrisA