Zeep 客户端服务请求缺少元素

问题描述

Python/Zeep 新手,请保持温和

将以下内容发布到我的端点时,一切都按预期工作:

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
    <Body>
        <PassthroughReq xmlns="http://amsservices.com/">
            <XMLinput>
                <INPUT>
                    <Account value="account" />
                    <Username value="username" />
                    <Password value="password" />
                    <Serverpool value="serverpool" />
                    <ProgramName name="WEBSERVICE.GET.POLICY.DATA.IDS" />
                    <Command cmd="279898" />
                </INPUT>
            </XMLinput>
        </PassthroughReq>
    </Body>
</Envelope>

我正在尝试使用以下代码复制请求:

import os
from zeep import Client

account = os.environ.get('sgws_account')
username = os.environ.get('sgws_username')
password = os.environ.get('sgws_password')
serverpool = os.environ.get('sgws_serverpool')
wsdl = os.environ.get('sgws_wsdl')

client = Client(wsdl)

xmlInput = {
    'INPUT':{
        'Account':account,'Username':username,'Password':password,'Serverpool':serverpool,'ProgramName':'WEBSERVICE.GET.POLICY.DATA.IDS','Command':'279898'
    }
}

ptr = client.get_element('ns0:PassthroughReq')(xmlInput)

client.service.PassthroughReq(XMLinput=ptr)

结果是“缺少任何元素”

我也尝试了如下请求,结果相同:

client.service.PassthroughReq(ptr)

wdsl 中的相关全局元素是:

ns0:PassthroughReq(XMLinput: {_value_1: ANY})

我将在下面的评论中粘贴完整的回溯。

我希望这是一个简单的失误,由于我的无知,但我不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)