Zeep-AttributeError:“架构”对象没有属性“渲染”

时间:2019-10-14 18:39:25

标签: python soap zeep

问题

我正在尝试使用 Zeep 模块访问SOAP协议,但是我认为WSDL文档缺少某些内容,因此我无法确切地理解该方法所期望的参数...

这是WSDL的相关部分,其中包含我尝试使用的方法:

<s:element name="EnviaSMSDataSet">
<s:complexType>
    <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="NumUsu" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="Senha" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="DS">
            <s:complexType>
                <s:sequence>
                    <s:element ref="s:schema"/>
                    <s:any/>
                </s:sequence>
            </s:complexType>
        </s:element>
    </s:sequence>
</s:complexType>

我这样调用此方法:

client.service.EnviaSMSDataSet(NumUsu=<username>, Senha=<password>, DS=<?>)

但是我不知道应该在 DS 参数中添加什么!


到目前为止我尝试过什么

如果我忽略该参数,Python会告诉我这一点:

zeep.exceptions.Fault: Server was unable to process request. ---> Object reference not set to an instance of an object.

如果我写的不是DS keyarg,则Python会给我这个错误:

TypeError: {https://www.twwwireless.com.br/reluzcap/wsreluzcap}EnviaSMSDataSet() got an unexpected keyword argument 'test'. Signature: `NumUsu: xsd:string, Senha: xsd:string, DS: {schema: , _value_1: ANY}`

如果我将空字典传递给DS keyarg,Python会提示我该错误:

AttributeError: 'Schema' object has no attribute 'min_occurs'

如果我尝试在其中写一些东西,Python会引发另一个错误:

AttributeError: 'Schema' object has no attribute 'render'

Zeep 显然也有一种用于收集复杂类型的方法( client.get_type()),但是我不确切知道是否有这种类型。 。?


支持

我已经联系了这项服务的支持,他们给了我一个有效请求的例子,但是我无法理解它:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <EnviaSMSDataSet xmlns="https://www.twwwireless.com.br/reluzcap/wsreluzcap">
            <NumUsu>LOGIN</NumUsu>
            <Senha>SENHA</Senha>
            <DS>
                <xs:schema id="myDataSet"
                    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
                    <xs:element name="myDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
                        <xs:complexType>
                            <xs:choice minOccurs="0" maxOccurs="unbounded">
                                <xs:element name="enviaSMSDataset">
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element name="seunum" type="xs:string"minOccurs="0"/>
                                            <xs:element name="celular" type="xs:string"minOccurs="0"/>
                                            <xs:element name="mensagem" type="xs:string"minOccurs="0"/>
                                            <xs:element name="agendamento" type="xs:dateTime"minOccurs="0"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                            </xs:choice>
                        </xs:complexType>
                    </xs:element>
                </xs:schema>
                <diffgr:diffgram
                    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
                    xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
                    <myDataSet>
                        <enviaSMSDataset diffgr:id="enviaSMSDataset1" msdata:rowOrder="1">
                            <seunum xml:space="preserve">saass</seunum>
                            <celular>5511999999999</celular>
                            <mensagem>Olá Mundo</mensagem>
                            <agendamento>2013-02-22T08:22:54</agendamento>
                        </enviaSMSDataset>
                        <enviaSMSDataset diffgr:id="enviaSMSDataset2" msdata:rowOrder="2">
                            <seunum xml:space="preserve">asdd</seunum>
                            <celular>5511999999991</celular>
                            <mensagem>Olá Mundo</mensagem>
                            <agendamento>2013-02-22T08:22:54</agendamento>
                        </enviaSMSDataset>
                    </myDataSet>
                </diffgr:diffgram>
            </DS>
        </EnviaSMSDataSet>
    </soap:Body>
</soap:Envelope>

如果缺少任何解释或任何内容,我很乐意提供!

({This是完整的WSDL文档,如果有帮助的话!)

0 个答案:

没有答案