I'm running SUDS 0.4 on Linux Slackware 13.0 with python 2.6.2. When I call SOAP method using this code:
from suds.client import Client
client = Client(url='file:acctWeb.wsdl',
location='http://10.242.69.4:8088/pfmaccess')
res = client.service.login(login='user',password='passwd')
I receive following response:
DEBUG:suds.transport.http:received:
CODE: 200
HEADERS: {'set-cookie': 'OSP_Ref=0000000573800052;Domain=10.242.69.4:8088;Path=/pfmaccess', 'content-length': '26541', 'content-type': 'text/xml; charset=utf-8', 'connection': 'close', 'server': 'Alcatel-Lucent OSP 2.4'}
but
>>> client.options.transport.cookiejar
<cookielib.CookieJar[]>
shows that there are no cookies available. What could be a reason for that? I'm not able to use SOAP API because I need to pass credentials sent in response cookie.
Please help me on this.
BR
rjan
Ok, i've played around a bit with it.
first, a little test server (courtesy of soaplib):
with some little modification to set a cookie header.
and a suds-testclient:
running this produces:
so it seams to work. but if you change the request url to
http://localhost:7789/?wsdl
you'll get:turning on some logging for
cookielib
at the client...... and it reveals reveals why:
the simple explanation is: the cookie domain does not match the request's server domain, and as it seems
cookielib
does not do any lookup when verifying the domain.so the solution would be one of:
in the example i have to set both to
localhost.local
to make it work (may depend on thehosts
file...)cookieib
uses the request domain automaticallyOh, and last but not least: the reason why it didn't work in the OPs question:
the port is not part of the domain, therfore a cookie with
Domain=10.242.69.4:8088
will always be rejected.