python中wsdl的Xml请求

2024-06-11 05:08:52 发布

您现在位置:Python中文网/ 问答频道 /正文

有了SoapUi,我可以用一种非常简单的方式从wsdl获得每个操作的xml请求。
我希望在python中得到相同的结果。我试着使用zeep,我看到它提供了一个方法:create\u message()但是由于我不知道输入数据结构,它对我不起作用。

我尝试使用:

node = client.create_message(client.service, 'myOperation')

但我得到一个错误:

"Missing element %s" % (self.name), path=render_path)
zeep.exceptions.ValidationError: Missing element myOperationInput

我希望获得的xml请求是:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://myCorporate/myOperation_V01/Interface">
   <soapenv:Header/>
   <soapenv:Body>
      <int:myOperation>
         <myOperationInput>
            <par1>?</par1>                            
         </myOperationInput>
      </int:myOperation>
   </soapenv:Body>
</soapenv:Envelope>

如何在不知道参数列表的情况下从wsdl获取xml请求


Tags: pathclientmessagecreatexmlelementwsdlint