Python:通过 Suds (jurko) 发送 Raw XML
Python: Sending Raw XML via Suds (jurko)
我正在与 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 HTML-对我刚发送的 XML 字符串进行编码,如下所示:
<?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>
嘘!有什么方法可以让泡沫在 XML 字符串中不加改变地传递吗?
谢谢!
好的,知道了。
from suds.sax.text import Raw
import suds.client as sudscl
client = sudscl.Client('http://host/ws.wsdl', location='http://host/ws')
session = 'test123'
options = Raw('<rawXML><Item>Foobar</Item></rawXML>')
result = client.service.ExecuteSearch(session, options)
我正在与 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 HTML-对我刚发送的 XML 字符串进行编码,如下所示:
<?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>
嘘!有什么方法可以让泡沫在 XML 字符串中不加改变地传递吗?
谢谢!
好的,知道了。
from suds.sax.text import Raw
import suds.client as sudscl
client = sudscl.Client('http://host/ws.wsdl', location='http://host/ws')
session = 'test123'
options = Raw('<rawXML><Item>Foobar</Item></rawXML>')
result = client.service.ExecuteSearch(session, options)