mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 586 forks source link

How do I start passing type and value using Python Zeep client #1295

Open sushilatmoveworks opened 2 years ago

sushilatmoveworks commented 2 years ago

So here is my xml looks like

<ns0:Organization_Reference>
    <ns0:ID ns0:type="Company_Reference_ID">
    </ns0:ID>
</ns0:Organization_Reference>

Inside code I am doing this

'Organization_Reference': {'ID': {'type': 'Company_Reference_ID'}},

I am expecting my final XML to look like this

<ns0:Organization_Reference>
   <ns0:ID ns0:type="Company_Reference_ID"> 1234
   </ns0:ID>
</ns0:Organization_Reference>

My problem here is that I could not figure out how to pass the value - 1234 into the python dictionary which is required as data

arnabJ commented 2 years ago

@sushilatmoveworks I was facing the same issue today and came across this guide while trying to find a solution. It worked for me.

Give this a try: https://adriennedomingus.medium.com/using-zeep-to-make-soap-requests-in-python-c575ea0ee954

To summarize: 'Organization_Reference': {'ID': {'type': 'Company_Reference_ID', '_value_1': 1234}},