python - 在 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>
解决方案
推荐阅读
- php - 方法 Illuminate\Http\UploadedFile::resize 使用 laravel 6 不存在
- reactjs - 使用子箭头函数更改父级状态,React
- c# - 如何在 IEnumerable 和 IQueryable 之间干燥查询逻辑?
- mongodb - 当我的默认数组为空时,为什么猫鼬会用空字符串调用我的验证器?
- python - 将数据从类中传递到 def
- javascript - CakePHP 允许表单提交 javascript 代码
- anaconda - 如何防止 Anaconda 'conda update --all' 降级我的 Tensorflow 安装
- list - 在未排序的数字数组中查找具有给定总和的所有对
- java - 如何找到 java 的方法是如何写在 itellj 上的?
- authentication - 具有 okta 身份验证的 Nodejs 应用程序将“X-Frame-Options”抛出到“sameorigin”错误和状态不匹配错误