我与SOAP API接口,其中特定方法需要原始XML字符串作为参数。像这样:
import suds.client as sudscl
client = sudscl.Client('http://host/ws.wsdl', location='http://host/ws')
session = 'test123'
options = '<rawXML><Item>Foobar</Item></rawXML>'
result = client.service.ExecuteSearch(session, options)
非常直截了当。但是,suds对我刚发送的XML字符串进行HTML编码,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://host/ws">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:ExecuteSearch>
<ns0:session>test123</ns0:session>
<ns0:options>
<rawXML&rt;<Item&rt;Foobar</Item&rt;</rawXML&rt;
</ns0:options>
</ns0:ExecuteSearch>
</ns1:Body>
</SOAP-ENV:Envelope>
啵!有没有办法让suds传递未改变的XML字符串?
谢谢!
答案 0 :(得分:2)
好的,明白了。
py -u "C:\Whatever\yourFile.py"