Can't get around HTTP/401 response using SUDS

  • Thread starter Adam Tauno Williams
  • Start date


Adam Tauno Williams

SUDS version 0.4 pn x86_64 Python 2.7

I'm having a bear of a time getting HTTP Basic Authentication to work
for a SOAP request via suds. Also using an HTTP proxy server.

In WireShark I just see a request -
GET http://...../services/services/JobService-0.0.1?wsdl HTTP/1.1
Accept-Encoding: identity
Host: .......
Connection: close
User-Agent: Python-urllib/2.7

This doesn't contain any authentication credentials so the response is
HTTP/401, and the client doesn't retry with credentials. The response
does come from the remote as I can see there is a WWW-Authenticate
header and it is from an Apache Tomcat server - so it makes it through
the proxy server.

url = 'http://....../services/services/JobService-0.0.1?wsdl'
proxy = urllib2.ProxyHandler({'http': 'http://.....:3128'})
transport = suds.transport.http.HttpAuthenticated()
transport.urlopener = urllib2.build_opener(proxy)
client = suds.client.Client(url, transport=transport,
username='******', password='********')

I've tried the above as well as the method described at
<> It has the same problem.

Back Trace
Traceback (most recent call last):
File "", line 30, in <module>
client = suds.client.Client(url, transport=transport,
username='*******', password='*****')
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/", line 112, in __init__
self.wsdl =
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/", line 152, in open
d = self.fn(url, self.options)
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/", line 136, in __init__
d =
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/", line 79, in open
d =
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/", line 95, in download
fp =
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/transport/", line 173, in open
return, request)
"/usr/local/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/transport/", line 64, in open
raise TransportError(str(e), e.code, e.fp)
suds.transport.TransportError: HTTP Error 401: Unauthorized


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question