pysimplesoap for base64Binary

时间:2016-03-16 23:48:05

标签: python wsdl pysimplesoap

这是我的代码:

from pysimplesoap.client import SoapClient,SimpleXMLElement
client = SoapClient(wsdl='urlToMyWsdl?wsdl')
print client.help("myMethod")
client.myMethod(arg0='mystring', arg1='thisCauseMeError')

帮助功能打印:     myMethod(arg0 = type' str'>,arg1 = * {} *)

在wsdl文件的myMethod中,变量arg1是base64Binary。 python期望一个Ordered字典,但我不知道如何设置它。任何想法?

1 个答案:

答案 0 :(得分:0)

# Try something like this:
# test_base64binary.py

from base64 import b64decode, b64encode

arg1_prep = {'brunch': 'toast', 'lunch': 'BBQ', 'dinner': 'burger'}

arg1 = b64encode(str(arg1_prep))
print(arg1)

decoded_arg1 = b64decode(arg1)
print(decoded_arg1)