Hello,
When I run the following script in zeep ver: 2.5.0,
from zeep import Client
client = Client("sample.wsdl")
request_data = {"input":{
"Header_Info": {
"UserName": "abc",
"Password": "123",
}},
"Order_No": "abc"}
response = client.create_message(client.service, "OrderCancel", request_data)
the following error arises on https://github.com/mvantellingen/python-zeep/blob/master/src/zeep/xsd/elements/element.py#L236
zeep.exceptions.ValidationError: Missing element Header_Info (OrderCancel.input)
Sample wsdl is in https://gist.github.com/nihankarslioglu/d283589e9cea1ecc5d577f120572f9f7
I got this error for already defined element in the request. When the outer element("input") is removed as the following script, the problem is fixed.
from zeep import Client
client = Client('sample.wsdl')
request_data = {
"Header_Info": {
"UserName": "abc",
"Password": "123",
},
"Order_No": "abc"}
response = client.create_message(client.service, 'OrderCancel', request_data)
When I debug your code for these requests, I see that _StaticIdentity value of Header_Info Element is set as NotSet and then error occurs. In working request, _StaticIdentity value of Header_Info element is defined as in the request, and no problem occurs.
I need a permanent solution. We automatically parse WSDLs of services we use via zeep and we have to make requests to the services as defined in the WSDL. We don't have this error in some of our services, but we sometimes encounter this problem.
Any help would be appreciated.
Thank you,
Have you tried turning it off and on again ?
The problem was passing parameters into function by normal arguments not by keyword arguments. Putting double stars before parameter solved the problem.
response = client.create_message(client.service, "OrderCancel", **request_data)
I think turning it off and on solved the problem but anyway 馃憤 馃
its giving output as a object
Most helpful comment
The problem was passing parameters into function by normal arguments not by keyword arguments. Putting double stars before parameter solved the problem.