Changes between Version 3 and Version 4 of SoapToPython


Ignore:
Timestamp:
Jun 29, 2010 2:58:53 AM (14 years ago)
Author:
faber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SoapToPython

    v3 v4  
    9797}}}
    9898
    99 An example of that datatype that only
     99An example of that datatype that only includes 2 nodes encoded as a dict is:
     100
     101{{{
     102vtopoType = {
     103   "node": [ { 'name' : 'name1', 'ips': '10.1.1.1', }, { 'name': 'name2', 'ips': '10.1.2.1', }, ]
     104}
     105}}}
     106
     107Some types are defined not as a sequence, but as a choice.  For example, an {{{IDType}}} is defined (in [source:wsdl/trunk/fedd_types.xsd fedd_types.xsd] as the rest of these examples are) as:
     108
     109{{{
     110  <xsd:complexType name="IDType">
     111    <xsd:annotation>
     112      <xsd:documentation>
     113        An ID is an identifier for a principal, service, or object.  This type
     114        is currently polymorphic o allow different implementations of type,
     115        though running code primarily uses localnames and fedids.
     116      </xsd:documentation>
     117    </xsd:annotation>
     118    <xsd:choice>
     119      <xsd:element name="uuid" type="xsd:base64Binary"/>
     120      <xsd:element name="fedid" type="xsd:base64Binary"/>
     121      <xsd:element name="uri" type="xsd:string"/>
     122      <xsd:element name="localname" type="xsd:string"/>
     123      <xsd:element name="kerberosUsername" type="xsd:string"/>
     124    </xsd:choice>
     125  </xsd:complexType>
     126}}}
     127
     128When represented as a dict, that will dict will have only one key, chosen from the set { 'uuid', 'fedid', 'uri', 'localname', 'kerberosUsername' }.
     129
     130Others include restricted values, for example the {{{statusType}}} is defined in [source:wsdl/trunk/fedd_types.xsd fedd_types.xsd]:
     131
     132{{{
     133  <xsd:simpleType name="statusType">
     134    <xsd:annotation>
     135      <xsd:documentation>
     136        The current state of the experiment.
     137      </xsd:documentation>
     138    </xsd:annotation>
     139    <xsd:restriction base="xsd:string">
     140      <xsd:enumeration value="empty"/>
     141      <xsd:enumeration value="active"/>
     142      <xsd:enumeration value="starting"/>
     143      <xsd:enumeration value="terminating"/>
     144      <xsd:enumeration value="failed"/>
     145    </xsd:restriction>
     146  </xsd:simpleType>
     147}}}
     148
     149When instantiated as a dict, the values are constrained to be from the set { 'empty', 'active', 'starting', 'terminating', 'failed' }, and if another value is encoded, it results in an error.
     150
     151With those rules is should be straightforward to convert from the XSD descriptions to the python datatypes.