I have an example of xml request that should go to the SOAP server like so:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://service.example.com"
xmlns:bos="http://bos.example.com"
xmlns:ser1="http://service.example.com">
<soapenv:Header/>
<soapenv:Body>
<ser:UploadRequest ac="YY">
<ser:updateRecord>
<ser:employee ptc="xxx" lastname="Example" firstname="Employee"
gender="F">
<bos:employment eID="testEmployee" doj="2000-01-17"/>
<bos:employment-status startDate="2000-01-17" status="active"/>
</ser:employee>
</ser:updateRecord>
</ser:UploadRequest>
</soapenv:Body>
</soapenv:Envelope>
The service name here is Upload and the action is updateRecord. I failed to format this request using python zeep.
I have tested using soapui and it works. Now I need to send request using python and zeep but I still failed as I am new in SOAP and Zeep.
Here is what I tried:
from requests import Session
from zeep import Client
from zeep.cache import SqliteCache
from zeep.transports import Transport
from lxml import etree
session = Session()
session.cert = 'client.pem'
transport = Transport(session=session,cache=SqliteCache())
client = Client('example.wsdl',transport=transport)
request_data = {
'updateRecord':{
'ac': 'HF',
'ptc': 'yy',
'lastname':'Lasme',
'firstname':'Didier',
'gender':'M',
'eID':'ACI001014',
'doj':'2000-01-17'
}
}
xml = client.create_message(client.service,'Upload',**request_data)
print(etree.tostring(xml, encoding="unicode", pretty_print=True))
and I am getting this error
TypeError: {http://service.example.com}UpdateRecord() got an
unexpected keyword argument 'eID'. Signature: `employee:
{http://bos.example.com}Employee
What I need is How to use zeep to format the above request.