ZEEP文檔例如:如何在python soap模塊zeep中處理complexType參數?
from zeep import Client
client = Client('http://my-enterprise-endpoint.com')
client.service.submit_order(user_id=1, order={
'number': '1234',
'price': 99,
})
我的使用情況:
我想打電話,需要一個參數 'findCriteria'
示例web服務:
findcriteria = {
'Criteria' : [{
'ColumnName' : 'Closed',
'Value' : 0
},
{
'ColumnName' : 'AssignToQueueID',
'Value' : queueid
},
{
'ColumnName' : 'SupportCallType',
'Value' : 'I'
}
]
}
調用服務:
print clien t.service.GetCount(findCriteria = findcriteria)
這是所創建的XML:
<soap-env:Body>
<ns1:GetCount>
<ns1:findCriteria/>
</ns1:GetCount>
</soap-env:Body>
</soap-env:Envelope>
問題:
雖然服務返回的計數,所述標準是沒有申請。
當我爲服務提供原始XML有效負載時,結果是正常的。
問題出在<ns1:findCriteria/>
部分。
對於每一列應該創建一個Criteria元素。在WSDL的grep getCount將的
結果:
<s:element name="GetCount">
<s:element name="GetCountResponse">
<s:element minOccurs="1" maxOccurs="1" name="GetCountResult" type="s:int" />
<wsdl:message name="GetCountSoapIn">
<wsdl:part name="parameters" element="tns:GetCount" />
<wsdl:message name="GetCountSoapOut">
<wsdl:part name="parameters" element="tns:GetCountResponse" />
<wsdl:operation name="GetCount">
<wsdl:input message="tns:GetCountSoapIn" />
<wsdl:output message="tns:GetCountSoapOut" />
<wsdl:operation name="GetCount">
<soap:operation soapAction="http://<server>/webservices/SupportCall/GetCount" style="document" />
<wsdl:operation name="GetCount">
<soap12:operation soapAction="http://<server>/webservices/SupportCall/GetCount" style="document" />
跟着你的建議,但還是沒有結果。問題出現在('ns1:findCriteria。這不是有效的類型。謝謝你的努力。 – Peter
可以共享命令輸出'python -mzeep | grep GetCount'? –
這個命令不能幫助我,因爲我的wsdl是身份驗證。我放置了wsdl local,但是它試圖包含身份驗證背後的其他模式。 – Peter