We recently turned on Basic Authentication for our service.
I can login ok, IF I have the wsdl as a file. However, if I try to get the
wsdl using url + '?wsdl' it fails miserably.
In desperation I have create the following function:
from urllib import *
from urllib2 import *
...
def getWSDL(url, realm, filename, user, pwd):
auth = HTTPBasicAuthHandler()
auth.add_password(realm, url, user, pwd)
opener = build_opener(auth)
u = opener.open(url)
response = u.read()
u.close()
f = open(filename, 'wb')
f.write(response)
f.close()
getWSDL(url + '?wsdl', 'myrealm', 'myservice.wsdl', user, pwd)
Then I can get the wsdl file, and do the client create.
Is there a better way than this?
Jerry