Hello
Is the first time I am trying connect to a soap web service using using python. Existing libraries are very poor in my opinion (mainly by the interface) but I like suds and would like use it because is very pleasant. But I have a problem with the concrete serviece I need to use and I didn't find the solution.
The service description is: https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?WSDL and I neet call to "Logon" function. The service runs correctly (I can use it with ZSI)
I tried:
{{{ vojo_auth_uri = "https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl" logger('suds.serviceproxy').setLevel(logging.DEBUG) auth_proxy = ServiceProxy(vojo_auth_uri) logon = auth_proxy.get_instance('Logon') logon.Username.append("user") logon.Password.append("password") print auth_proxy.Logon(logon)
}}}
When I run that code I get this error "You must specify both your username and password.at FreewayAuth.Logon(String Username, String Password)"
The problem is that suds does NOT send a correct xml. The service expects (as documented in https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?op=Logon ):
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/%22%3E soap:Body <Logon xmlns="http://tempuri.org/"> <Username>string</Username> <Password>string</Password> </Logon> </soap:Body> </soap:Envelope>
But the library send:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://tempuri.org/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/%22%3E SOAP-ENV:Body tns:Logon <Username> <Username>user</Username> <Password>password</Password> </Username> </tns:Logon> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
The error: Note the extra Username tag.
Am I using the library correctly? Is an library error?
Thanks in advance
PD: Please excuse my bad english