Hi,
I'm currently having a really bad time with suds 0.4 and the following
web service:
https://soap.mediafinanz.de/encashmentLiteral201.wsdl
When calling newClaim() with a typens:Debtor containing an umlaut (in
my case 'ü'), I get a "UnicodeDecodeError: 'ascii' codec can't
decode
byte 0xc3 in position 822: ordinal not in range(128)".
Pylons's debugger tells me, that httplib tries to concat the unicode
head: u'POST /encashmentLiteral201 [...]' with the payload which seems
to be an UTF-8 encoded string: '<?xml version="1.0"
encoding="UTF-8"?><SOAP-ENV:Envelope[...]\xc3\xbc[...]'.
If I'm not mistaken, \xc3\xbc is the perfectly correct Unicode point for
"ü".
The complete traceback looks like this:
File '<string>', line 2 in start_encashments
File
'/vrmd/Dunning/Dunning-0.10dev/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/decorators/rest.py',
line 33 in check_methods
return func(*args, **kwargs)
File '/vrmd/Dunning/Dunning-0.10dev/dunning/controllers/dun.py', line
332 in start_encashments
cc_with_inv=cust)
File '/vrmd/Dunning/Dunning-0.10dev/dunning/controllers/encashment.py',
line 145 in new_claim
nc = soap.service.newClaim(soap.auth, claim, debtor)
File 'build/bdist.linux-x86_64/egg/suds/client.py', line 542 in __call__
File 'build/bdist.linux-x86_64/egg/suds/client.py', line 602 in invoke
File 'build/bdist.linux-x86_64/egg/suds/client.py', line 637 in send
File 'build/bdist.linux-x86_64/egg/suds/transport/https.py', line 64 in send
File 'build/bdist.linux-x86_64/egg/suds/transport/http.py', line 77 in send
File 'build/bdist.linux-x86_64/egg/suds/transport/http.py', line 118 in u2open
File '/vrmd/python2/lib/python2.7/urllib2.py', line 391 in open
response = self._open(req, data)
File '/vrmd/python2/lib/python2.7/urllib2.py', line 409 in _open
'_open', req)
File '/vrmd/python2/lib/python2.7/urllib2.py', line 369 in _call_chain
result = func(*args)
File '/vrmd/python2/lib/python2.7/urllib2.py', line 1181 in https_open
return self.do_open(httplib.HTTPSConnection, req)
File '/vrmd/python2/lib/python2.7/urllib2.py', line 1142 in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File '/vrmd/python2/lib/python2.7/httplib.py', line 946 in request
self._send_request(method, url, body, headers)
File '/vrmd/python2/lib/python2.7/httplib.py', line 987 in _send_request
self.endheaders(body)
File '/vrmd/python2/lib/python2.7/httplib.py', line 940 in endheaders
self._send_output(message_body)
File '/vrmd/python2/lib/python2.7/httplib.py', line 801 in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
822: ordinal not in range(128)
I'm using Python 2.7 and suds 0.4.
So what am I doing wrong? I'm pretty sure to supply all the strings as
Unicode (they come from SQLAlchemy database), I checked it with "print
type()". Receiving umlauts doesn't seem to be a problem.
I'd be most grateful for any hint for I've spent several hours with
this right now. I'd be happy to provide any additional information if
necessary.
TIA,
Hynek