What steps will reproduce the problem?
1. Use type mapping (ie: wsdl)
2. Call a function that returns a string with non-ascii characters
3.
What is the expected output? What do you see instead?
I'd expect to get a unicode string. Instead the library attempts to convert it
to a 'str' instance, which throws the following exception;
...
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/simplexml.py", line 366, in unmarshall
raise ValueError("Tag: %s: %s" % (name, unicode(e)))
ValueError: Tag: domesticText: ('ascii', u'Bergs\xe5ker', 5, 6, 'ordinal not in
range(128)')
What version of the product are you using? On what operating system?
pysimplesoap-1.02c.zip
Please provide any additional information below.
Because there are two keys mapping to 'string' in TYPE_MAP (in simplexml.py),
the REVERSE_TYPE_MAP in client.py can map 'string' to either unicode or str. On
my machine it mapped to str, which caused the failure. Here is the simple fix;
--- a/pysimplesoap/client.py
+++ b/pysimplesoap/client.py
@@ -248,6 +248,7 @@ class SoapClient(object):
get_local_name = lambda s: str((':' in s) and s.split(':')[1] or s)
REVERSE_TYPE_MAP = dict([(v,k) for k,v in TYPE_MAP.items()])
+ REVERSE_TYPE_MAP['string'] = unicode
def fetch(url):
"Fetch a document from a URL, save it locally if cache enabled"
Original issue reported on code.google.com by misc%hl....@gtempaccount.com on 5 Jan 2011 at 5:50
Original issue reported on code.google.com by
misc%hl....@gtempaccount.com
on 5 Jan 2011 at 5:50