【问题标题】:How to add a prefix to an operation in Zeep?如何在 Zeep 中为操作添加前缀?
【发布时间】:2021-01-28 22:35:09
【问题描述】:

需要一些有关 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>

提前致谢!

【问题讨论】:

    标签: python soap soap-client zeep


    【解决方案1】:

    已通过放置:

    client.set_ns_prefix("v7","http://foobar/foo/bar/foo/v7")
    

    收件人:

    client.set_ns_prefix(None,"http://foobar/foo/bar/foo/v7")
    

    【讨论】:

      猜你喜欢
      • 2018-11-01
      • 2011-06-06
      • 1970-01-01
      • 1970-01-01
      • 2021-10-22
      • 2021-12-16
      • 2013-07-05
      • 2015-12-05
      相关资源
      最近更新 更多