Python SUDS - WSDL poll for MinOccurs and MaxOccurs values

I would like to interrogate WSDL using SUDS to get the web service parameters and attributes. I pretty much went down to this last thing. How can I interrogate the service to find the values ​​of minOccurs and maxOccurs parameters?

I see there a property in the suds.xsd.sxbase object that is required, but, considering that the client object is the starting point, I do not see the path to it.

http://jortel.fedorapeople.org/suds/doc/suds.xsd.sxbase-pysrc.html#SchemaObject.required

client = Client(endpoint, username=username, password=password) client.service[0][method] 

How do I know if a parameter is related?

Thanks!

0
source share
1 answer

you can query the factory constructor for the method and use the children () method to view its parameters.

For example, for this method I have wsdl:

 <complexType name="AddAuthorizationRoleRequestType"> <sequence> <element name="_this" type="vim25:ManagedObjectReference" /> <element name="name" type="xsd:string" /> <element name="privIds" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> </sequence> </complexType> 

I can get the attributes via:

 >>> a=client.factory.resolver.find("ns0:AddAuthorizationRoleRequestType") >>> priv_el=a.children()[2][0] <Element:0x107591a10 name="privIds" type="(u'string', u'http://www.w3.org/2001/XMLSchema')" /> >>> priv_el = a.children()[2][0] >>> priv_el.max unbounded >>> priv_el.min 0 

not very elegant but it works

0
source

All Articles