Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'messages.': 0.04; 'lines,': 0.05; 'modified': 0.05; 'layers': 0.07; 'parameter': 0.07; 'raised': 0.07; 'soap': 0.07; 'testing,': 0.07; 'python': 0.09; 'dict': 0.09; 'it;': 0.09; 'url:apache': 0.09; 'library': 0.15; 'server,': 0.15; "'';": 0.16; '(another': 0.16; '24,': 0.16; 'buggy': 0.16; 'bypassing': 0.16; 'datei': 0.16; 'dump': 0.16; 'echo': 0.16; 'fatal': 0.16; 'fehler': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'partly': 0.16; 'scope,': 0.16; 'sha1': 0.16; 'skip:k 120': 0.16; 'subject:array': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'using,': 0.16; 'wieder': 0.16; 'string': 0.17; 'wrote:': 0.17; 'skip:{ 20': 0.17; 'code,': 0.18; 'packaging': 0.20; 'putting': 0.20; 'error.': 0.21; 'assuming': 0.22; 'http': 0.22; 'skip:$ 20': 0.22; 'work,': 0.22; "i've": 0.23; 'tried': 0.25; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'looks': 0.26; 'skip:" 20': 0.26; 'am,': 0.27; 'easiest': 0.27; 'zur': 0.27; 'message-id:@mail.gmail.com': 0.27; 'crash': 0.29; 'sites.': 0.29; 'class': 0.29; 'this.': 0.29; "i'm": 0.29; 'maybe': 0.29; "skip:' 10": 0.30; 'ends': 0.30; 'error': 0.30; 'figure': 0.30; 'code': 0.31; 'generally': 0.32; "skip:' 20": 0.32; 'skip:s 30': 0.33; 'largely': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'likely': 0.33; 'that,': 0.34; 'version': 0.34; 'received:google.com': 0.34; 'done': 0.34; 'server': 0.35; 'received:209.85.220': 0.35; 'too.': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'skip:{ 10': 0.36; 'useful': 0.36; 'should': 0.36; 'xml': 0.37; 'option': 0.37; 'two': 0.37; 'being': 0.37; 'ones': 0.37; 'quite': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'object': 0.38; 'some': 0.38; 'login': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'url:schemas': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'you.': 0.61; 'matter': 0.61; 'telling': 0.61; 'latest': 0.61; "you'll": 0.62; 'back': 0.62; 'between': 0.63; 'production': 0.63; 'more': 0.63; 'show': 0.63; 'differences': 0.65; 'skip:$ 10': 0.66; 'talking': 0.66; 'discover': 0.72; 'details:': 0.74; 'url:1999': 0.74; '2013': 0.84; 'blob': 0.84; 'server.)': 0.84; 'skip:y 50': 0.84; 'difficult,': 0.91; 'jeder': 0.91; 'neuen': 0.91; 'subject:skip:S 20': 0.91 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:content-transfer-encoding; bh=45jHMlQwj++58pLxbnH3ppLXYhNoZrRWVeU8V6zX1fg=; b=IWojHwNSH7tmgrVkUOU5Ig3AEQe9ter4MDknEpFB0qoQssqnAkg6ieuNjtz2HHVIqO 1zvFkcx2GFgNNO11Xz5tmpD64ADdoPsEOsAeKbriCwwi0pwtKd6r49haN97/c5Cub6EJ dMyUsbzZj44lzTsAWqqxc7uWxy1luO/Q6dBRWeikuqY8v4dYxxw08FyMum4ziwBPrEYp Ewxh2M22wnObjeq7HPatKKtdBKiej874n1bJiL4qhOaPilUWPohZxinasGHLSMJCwNnX BhMl45encMkohY2W4xa33m8sfe4seOelfvGV8cgWgu2V/u9OkiqE9sca+2HJD9XGUkL9 g66w== MIME-Version: 1.0 X-Received: by 10.220.109.145 with SMTP id j17mr8501481vcp.34.1364072100322; Sat, 23 Mar 2013 13:55:00 -0700 (PDT) In-Reply-To: <514E04C1.20505@googlemail.com> References: <514A0898.4000807@googlemail.com> <514DAF1D.50801@googlemail.com> <514E04C1.20505@googlemail.com> Date: Sun, 24 Mar 2013 07:55:00 +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 Content-Transfer-Encoding: quoted-printable 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: 175 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364072110 news.xs4all.nl 6857 [2001:888:2000:d::a6]:52040 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41752 On Sun, Mar 24, 2013 at 6:38 AM, Tamer Higazi wrote= : > Chris! > I did what you said before in several ways. > > The last way was putting the user and password directly into the dict as > parameter ALWAYS ends up telling me, that I cannot use object of > standard type class as ARRAY.... > > I did it this time with suds. So packaging issue is now out of scope, > and always the same headache. > > > now tell me what this error might tell me: > > > suds.WebFault: Server raised fault: 'Cannot use object of type stdClass > as array' So it's the same error this way, too. That error came back from the server, and is being quoted verbatim. That means that, ultimately, the problem is in the XML blob that you're sending it; the trick is to figure out what exactly the server isn't happy with. (Aside: The server is at least partly at fault here. It should be giving more useful error messages. But I'm assuming you don't have any control over the server.) I tried the reference PHP implementation off the web site, and it's coming back with 500 Internal Server Error with body of text/html, which is clearly buggy documentation. When I change it to use the WSDL you're using, I can actually get something plausible out of it. Modified PHP code: 1]); // url zur wsd= l - Datei $CredentialToken =3D $SoapLogon->KasAuth( array('KasUser' =3D> $kas_user, 'KasAuthType' =3D> 'sha1', 'KasPassword' =3D> sha1($kas_pass), 'SessionLifeTime' =3D> $session_lifetime, 'SessionUpdateLifeTime' =3D> $session_update_lifetime ) ); } // Fehler abfangen und ausgeben catch (SoapFault $fault) { echo "Request:\n".$SoapLogon->__getLastRequestHeaders()."\n".$SoapLogon= ->__getLastRequest()."\n"; echo "Response:\n".$SoapLogon->__getLastResponseHeaders()."\n".$SoapLog= on->__getLastResponse()."\n"; trigger_error("Fehlernummer: {$fault->faultcode}, Fehlermeldung: {$fault->faultstring}, Verursacher: {$fault->faultactor}, Details: {$fault->detail}", E_USER_ERROR); } (Another aside: Until I added the two echo lines, this had a try/catch that simply triggered a fatal error. This is pointless. Just let the error happen!) Here's the packet the PHP code sends: KasUserw001234KasAuthTypesha1KasPassword2db6d21d365f544f7ca3bcfb443ac96898a7a069SessionLifeTime1800SessionUpdateLifeTimeY Here's what your original Python version sends, lifted via tcpdump as I'm not sufficiently familiar with soappy to get a full packet dump out of it: Y sha1 1800 login 5baa61e4c9b93f3f0682250b6cf8331b7ee68f= d8 And here's what your latest Python sends, lifted the same way for the same reason regarding suds: Ysha11800userlogin45f106ef4d5161e7aa38cf6c666607f25748b6ca The PHP version comes back with a fault string "kas_password_incorrect", which is what I would expect. The Python ones both show the PHP crash you described. I'm seeing quite a few differences between the three; figuring out what's the cause of the crash will be a matter of fiddling until you discover it. I would recommend, at least for testing, bypassing the whole SOAP library layer and putting XML data straight into HTTP requests. And maybe you'll find that's the easiest option for production code, too; I've done exactly that at work, talking to SOAP servers at eBay and other sites. Building up XML isn't difficult, and it's generally easier to have less layers to debug. Hope that's of at least some value to you. It looks likely the server's largely to blame for this. ChrisA