如何解决Python Zeep 格式良好的文档中需要根元素
尝试使用 Python 的 Zeep 包调用专有服务,因为它是专有的,我无法提供 WSDL URL,我们不得不签署协议。
from zeep.wsse.username import Usernametoken
from zeep import Client
client = Client('http://IP/<PATH>?<filename>.wsdl',wsse=Usernametoken('Username','Password'))
client.service.serviceName(param={'param': 1},param2={'param2': 2},param3={'param3': 3})
Fault: org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed:
生成的 XML
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Usernametoken>
<wsse:Username>USERNAME</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>
</wsse:Usernametoken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<ns0:proprietary xmlns:ns0="URL">
<details>
<proprietary>ACODE</proprietary>
<proprietary>CID</proprietary>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary>A</proprietary>
<proprietary>N</proprietary>
<proprietary>VAL</proprietary>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary>SAHIL</proprietary>
<proprietary>SHUKLA</proprietary>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary>01</proprietary>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</details>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<profile>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary>1000.0</proprietary>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<proprietary>T</cycleType>
<proprietary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</profile>
<proprietary>true</proprietary>
<proprietary>true</proprietary>
</ns0:proprietary>
</soap-env:Body>
</soap-env:Envelope>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。