Some languages like C# create an Auth object to authenticate themselves on a soap server.

for example

cpLatestBrief.authValue = new auth();
      cpLatestBrief.authValue.username = "username"; // your aql username
      cpLatestBrief.authValue.password = "password"; // your aql password

how can you do this with python?

i am using SOAPpy but have no idea how to do the auth object. I have tried doing

from SOAPpy import WSDL
print "Content-type: text/html\n"
wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
HTTPTransport.setAuthentication('username','password')
server = WSDL.Proxy(wsdlFile, transport=HTTPTransport)
print server.ApiVersion()

and i get nothing. From the company i am trying to connect to they are saying there is authentication errors

i have been using that tutorial, but it's aimed at using google. The authentication happens by using an API key. I need to use and Auth object.

If i do something like

from SOAPpy import WSDL       
wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
server = WSDL.Proxy(wsdlFile)    
print server.methods.keys()

all the method keys are printed out but as soon as i put in some http authentication nothing is displayed

wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
HTTPTransport.setAuthentication('adamplowman','AdAMicMAN')
server = WSDL.Proxy(wsdlFile, transport=HTTPTransport)
print server.methods.keys()

Anymore ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.