Search code examples
pythonsoapwsdlsuds

How to pass multiple variables as SUDS data in python?


Usually, I use dicts to call soap methods:

  SoapData = {'id':'1', 'nya':'meow'}
  Check ('SoapMethodName', SoapData)

It creates something like this:

<data:id>1</data:id>

<data:nya>meow</data:nya>

That works fine. But sometimes I need something like this in request:

<arg1>12<arg1>

<arg2>meow<arg1>

That means I can not use dictionaries. So I need a new function, which gets 2 data arguments:

  Check2 ('SoapMethodName', id, nya)

What if 20 data arguments are needed? How do I pass them? Arrays do not seem to work, is there a workaround?


Solution

  • args = [id, nya]
    Check2('SoapMethodName', *args)