I'm connecting with a SUDS client to a SOAP Server whose wsdl contains many enumerations like the following:
</simpleType>
<simpleType name="FOOENUMERATION">
<restriction base="xsd:string">
<enumeration value="ALPHA"><!-- enum const = 0 -->
<enumeration value="BETA"/><!-- enum const = 1 -->
<enumeration value="GAMMA"/><!-- enum const = 2 -->
<enumeration value="DELTA"/><!-- enum const = 3 -->
</restriction>
</simpleType>
In my client I am receiving sequences which contain elements of these various enumeration types. My need is that given a member variable, I need to know all possible enumeration values. Basically I need a function which takes an instance of one of these enums and returns a list of strings which are all the possible values.
When I have an instance, running:
print type(foo.enumInstance)
I get:
<class 'suds.sax.text.Text'>
I'm not sure how to get the actual simpleType name from this, and then get the possible values from that short of parsing the WSDL myself.
Edit: I've discovered a way to get the enumerations given the simpleType name, as below, so my problem narrows down to findingthe type name for a given variable, given that type(x) returns suds.sax.text.Text instead of the real name
for l in client.factory.create('FOOENUMERATION'):
print l[0]