I try to use SOAPpy to connect to a webservice. Each of the Methods from the Service uses Username an Passwort to authentification. The Passwort has one special german char ("ä").
When i am excecuting the following script:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SOAPpy import WSDL
server = WSDL.Proxy('http://www.example.com/xxx.asmx?WSDL')
server.HelloWorld("xxx","xxxäxxx")
I get this Output in Terminal.
Traceback (most recent call last):
File "./test.py", line 6, in <module>
server.HelloWorld("xxx","xxxäxxx")
File "/usr/lib/pymodules/python2.7/SOAPpy/Client.py", line 470, in __call__
return self.__r_call(*args, **kw)
File "/usr/lib/pymodules/python2.7/SOAPpy/Client.py", line 492, in __r_call
self.__hd, self.__ma)
File "/usr/lib/pymodules/python2.7/SOAPpy/Client.py", line 354, in __call
config = self.config, noroot = self.noroot)
File "/usr/lib/pymodules/python2.7/SOAPpy/SOAPBuilder.py", line 636, in buildSOAP
return t.build()
File "/usr/lib/pymodules/python2.7/SOAPpy/SOAPBuilder.py", line 147, in build
self.dump(i, typed = typed, ns_map = ns_map)
File "/usr/lib/pymodules/python2.7/SOAPpy/SOAPBuilder.py", line 303, in dump
meth(obj, tag, typed, ns_map)
File "/usr/lib/pymodules/python2.7/SOAPpy/SOAPBuilder.py", line 376, in dump_string
typed, ns_map, self.genroot(ns_map), id))
File "/usr/lib/pymodules/python2.7/SOAPpy/SOAPBuilder.py", line 339, in dumper
"id": id, "attrs": a}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)
How can i setup/init SOAPpy to work with UTF-8?
You have to use unicode strings:
server.HelloWorld("xxx", u"xxxäxxx")