Hello Jesper,
Thank you very much for your response. A response in 15 minutes! I really want to use suds :-D
I tested the code you send me with the correct username and password but I have the same error. I dont know why because It looks like a correct xml.
Maybe you can help me better if I give you more information. The ZSI code that works is: {{{ from FreewayAuth_services import * fp = open('debug.out', 'a') proxy = FreewayAuthLocator().getFreewayAuthSoap(tracefile=fp) logon = LogonSoapIn() logon._Username = user logon._Password = password ticket = proxy.Logon(logon) print ticket._LogonResult fp.close() }}} where FreewayAuth_services came from wsdl2py -u https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?WSDL
The xmls in debug.out is:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance%22%3ESOAP-ENV:Header</SOAP-ENV:Header><SOAP-ENV:Body xmlns:ns1="http://tempuri.org/%22%3Ens1:Logonns1:UsernameUSER</ns1:Username>ns1:PasswordBLABLA</ns1:Password></ns1:Logon></SOAP-ENV:Body></SOAP-ENV:Envelope>
The xml output is diferent, maybe ZSI runs because it use namespaces. How can I do it with suds?
Cheers
El Viernes 16 May 2008, Jesper Noehr escribió:
Hello Pablo,
I tried analyzing the WSDL you gave, and it seems that the "Logon" method does not take a "Logon" instance, but two strings; username and password.
Here's my code:
import logging from suds.serviceproxy import ServiceProxy
p = ServiceProxy('freeway.wsdl') logging.getLogger('suds.serviceproxy').setLevel(logging.DEBUG)
print p.Logon('foo', 'bar')
And here's what suds sends:
<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>foo</Username> <Password>bar</Password> </tns:Logon> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
The service still raises an error: faultstring = (System.Web.Services.Protocols.SoapException: You must specify both your username and password.at FreewayAuth.Logon(String Username, String Password))
...but that might be due to the wrong username and password?
HTH, Jesper