问题描述
需要一些有关 Zeep 格式问题的帮助。 Ready API 显示正在发送的操作名称前带有前缀“v7”。我怎样才能在 Zeep 中重现这个?
Zeep 输出:
<?xml version='1.0' encoding='utf-8'?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v7="http://ads.caiso.com/api/webservices/dispatch/v7">
<soap-env:Body>
<getdispatchBatchesSinceUID>
<batchUID>-1</batchUID>
</getdispatchBatchesSinceUID>
</soap-env:Body>
</soap-env:Envelope>
准备好的 API 输出:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v7="http://ads.caiso.com/api/webservices/dispatch/v7">
<soapenv:Header/>
<soapenv:Body>
<v7:getdispatchBatchesSinceUID soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<batchUID xsi:type="xsd:string">?</batchUID>
</v7:getdispatchBatchesSinceUID>
</soapenv:Body>
</soapenv:Envelope>
提前致谢!
解决方法
这是通过放置修复的:
client.set_ns_prefix("v7","http://foobar/foo/bar/foo/v7")
致:
client.set_ns_prefix(None,"http://foobar/foo/bar/foo/v7")