Skip to content Skip to sidebar Skip to footer

How To Specify Xsi:type Zeep Python

Im using zeep SOAP client for python, trying to get some data to some wsdl_address. i now have following: ambCase = {'data1':'value1', 'data2':'value2'} client = zeep.Client

Solution 1:

By trial and error the following combination worked:

objectType = client.get_type('ns6:someTypeName') # someTypeName will be in xsi:type attribute
objectWrap = xsd.Element('xmlTagName',objectType) # xmlTagName - name of created xml element
objectValue = objectWrap('param1',param2,param3[0]) # putting actual data values into object
client = zeep.Client(wsdl)
result = client.service.MethodName(objectValue) # calling  some method with your object(with explicitly detrmined type) as param

The thing is, if you pass a dict as method param, zeep will create that object himself(without type), if you want to determine type - create that object by yourself


Post a Comment for "How To Specify Xsi:type Zeep Python"