Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>At first glance looks like the problem you're having is with SSL. You are accessing an https URL, and the Transport handler for suds.client talks http by default. </p> <p><strong>The problem</strong><br> If you look at the bottom of the WSDL it is specifying the default location as <code>http://www.clarityaccounting.com/api/v1</code>, which is an http URL, but the WSDL is SSL.</p> <pre><code> &lt;wsdl:service name="v1"&gt; &lt;wsdl:port binding="tns:v1SoapBinding" name="BooksApiV1Port"&gt; &lt;soap:address location="http://www.clarityaccounting.com/api/v1"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; </code></pre> <p>If you do an http GET on that URL, you get the error message you received:</p> <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; &lt;soap:Fault&gt; &lt;faultcode&gt;soap:Server&lt;/faultcode&gt; &lt;faultstring&gt;No such operation: (HTTP GET PATH_INFO: /api/v1)&lt;/faultstring&gt; &lt;/soap:Fault&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p><strong>The Solution</strong><br> To fix this you need to override the default location when you call the <code>Client</code> constructor to make it stick with https:</p> <pre><code>&gt;&gt;&gt; url 'https://www.clarityaccounting.com/api/v1?wsdl' &gt;&gt;&gt; client = Client(url, location='https://www.clarityaccounting.com/api/v1') &gt;&gt;&gt; token = client.service.doLogin('demo', 'demo', 'www.kashoo.com', 'en_US', 300000) &gt;&gt;&gt; token (authToken){ authenticationCode = "ObaicdMJZY6UM8xZ2wzGjicT0jQ=" expiryDate = 2010-03-05 12:31:41.000698 locale = "en_US" myUserId = 4163 site = "www.kashoo.com" } </code></pre> <p><strong>Victory!</strong></p> <p>Pro tip for future debugging purposes: Turn on full logging debugging. SUDS uses the standard <code>logging</code> library, so it gives you a lot of control. So I cranked it all up to <code>DEBUG</code>:</p> <pre><code>import logging logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG) logging.getLogger('suds.transport').setLevel(logging.DEBUG) logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG) logging.getLogger('suds.wsdl').setLevel(logging.DEBUG) </code></pre> <p>This is what helped me narrow it down, because it was clearly saying it was sending over http:</p> <pre><code>DEBUG:suds.transport.http:sending: URL:http://www.clarityaccounting.com/api/v1 (xml output omitted) </code></pre> <p>And then the response said so as well:</p> <pre><code>DEBUG:suds.client:http failed: </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload