In Python, arguments of a function may be optional or mandatory. SOAP allows for repeated arguments as well; this is done using the customize() method of Soap objects.
Arguments of a SOAP method have various cardinality-related attributes:
Here is an example:
class MyService(DefinitionBase):
@soap(
String.customize(min_occurs=1, max_occurs=1, nillable=False),
String.customize(min_occurs=0, max_occurs="unbounded", nillable=True),
String.customize(min_occurs=4, max_occurs=10, nillable=False)
)
def my_method(self, mandatory_string, list_of_strings, a_few_strings):
pass
For the primitive types, there is no need to call the customize() method:
# These are equivalent
String(min_occurs=0, max_occurs=1, nillable=False)
String.customize(min_occurs=0, max_occurs=1, nillable=False)
The use of customize() is mandatory on custom classes (inheriting from ClassModel).