Problems parsing a response using suds
by Håkon Sagehaug
Hi all,
I've been trying to get my sts(WS-Trust) service working with suds, but I've
hit a problem when suds is trying to parse the request. The flow of the
execution is
1. Create a resquest for a security token that looks like this
<SOAP-ENV:Envelope xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext..."
xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit..."
xmlns:ns0="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:ns1="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security mustUnderstand="true">
<wsu:Timestamp>
<wsu:Created>2011-06-07T12:24:42.741387Z</wsu:Created>
<wsu:Expires>2011-09-05T12:24:42.741387Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password Type="None">password</wsse:Password>
<wsse:Nonce>2a5d2e30b318c1001bb0af853af466bf</wsse:Nonce>
<wsu:Created>2011-06-07T12:24:42.741335Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:RequestSecurityToken>
<ns0:RequestType>
http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</ns0:RequestType>
<ns0:TokenType>
http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1
</ns0:TokenType>
<ns0:KeyType>
http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey</ns0:KeyType>
<ns0:KeySize>256</ns0:KeySize>
<ns0:ComputedKeyAlgorithm>
http://schemas.xmlsoap.org/ws/2005/02/trust/CK/PSHA1
</ns0:ComputedKeyAlgorithm>
</ns0:RequestSecurityToken>
</ns1:Body>
</SOAP-ENV:Envelope>
This works fine, and when I've got logging on I can see theat the correct
response is coming back from the service. When parsing though, I get this
stacktrace
xxx = client.service.IssueToken(req_type["
http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue"],tok_type,key_type["
http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey
"],key_size,key_alg)
File "/scratch/hakont/python-suds-0.4/suds/client.py", line 542, in
__call__
return client.invoke(args, kwargs)
File "/scratch/hakont/python-suds-0.4/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "/scratch/hakont/python-suds-0.4/suds/client.py", line 643, in send
result = self.succeeded(binding, reply.message)
File "/scratch/hakont/python-suds-0.4/suds/client.py", line 678, in
succeeded
reply, result = binding.get_reply(self.method, reply)
File "/scratch/hakont/python-suds-0.4/suds/bindings/binding.py", line 145,
in get_reply
replyroot = sax.parse(string=reply)
File "/scratch/hakont/python-suds-0.4/suds/sax/parser.py", line 136, in
parse
sax.parse(source)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line
123, in parse
self.feed(buffer)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 220, in feed
self._err_handler.fatalError(exc)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/handler.py", line
38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: syntax error
I've checked the response, using xmlwf, and it's valid. Have anybody else
experinced this? A similar issue [1] was reported on the forum for 2 years
ago, but not sure if it was solved.
Cheers, Håkon
[1]
http://markmail.org/message/wfel6rsdyeas6lq4#query:xml.sax._exceptions.SA...
12 years, 11 months
Doubt about logging implementation
by Bruno Braga
Hi,
Sorry for my ignorance (and if this was already addressed here before), but
I could not find any references to this simple issue...
from suds.client import Client
print Client("http://server/service/?wsdl").service.MyMethod()
Every time I call the client everything works great, but I get a logger
warning:
No handlers could be found for logger "suds.umx.typed"
I read in the README
<http://svn.fedorahosted.org/svn/suds/trunk/README>file that the lib
was changed in a way the user would have to setup this
from outside... I wonder how to deal with this in case I don't want to setup
the logging for it externally.
In my case I am only interested in logging the exception it returns, rather
than internal stuff. I only saw examples for unit testing, which differs
from production code.
If I do something like this:
import logging
logging.basicConfig(level=logging.CRITICAL)
I can get rid of the message, but then it affects my own logging
implementation, unless I use instances of the logger to handle it
separately.
I might be doing something very wrong, but I just couldn't see the answer.
Any help is very appreciated.
Thanks,
--
*Braga, Bruno*
www.brunobraga.net
bruno.braga(a)gmail.com
12 years, 11 months
Multipart replies
by Antti Kaihola
On March 7 2011, Alejandro Blanco Escudero asked on this list:
>I've been using suds lately. The server I'm interacting with is returning
>multipart replies. I've looked around and I found this patch:
>https://fedorahosted.org/suds/ticket/308
>It works fine (at least for my use cases), but it's only available for the
>3.9 version of suds. It would be great to have multipart support in the
>newer releases. ¿Is there any intention to integrate this patch (or give
>support of multipart) into mainstream development?
I've updated the patch for suds revision 706 and attached the new
patch to the ticket. I also set up a repository mirror in GitHub and
created a branch in which I keep the patch up-to-date. See my comments
at https://fedorahosted.org/suds/ticket/308 for details.
12 years, 11 months