Changes between Version 2 and Version 3 of SoapToPython


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

--

Legend:

Unmodified
Added
Removed
Modified
  • SoapToPython

    v2 v3  
    1717Each of these is encoded into python in the obvious ways.  Doubles, floats and integers are python numbers; strings and base64Binaries are python strings; booleans are python variables set to True or False; and dateTimes are integers.
    1818
    19 As simple element is encoded as a dictionary mapping between name and value.  All the elements in the same sequence (an xsd grouping) are in the same dictionary.  So, for example, the {{{vtopolanType}}} complex type (from [source:wsdl/trunk/fedd_types.xsd]) is described in xsd as:
     19As simple element is encoded as a dictionary mapping between name and value.  All the elements in the same sequence (an xsd grouping) are in the same dictionary.  So, for example, the {{{vtopolanType}}} and {{{vtoponodeType}}} complex types (from [source:wsdl/trunk/fedd_types.xsd]) are described in xsd as:
    2020{{{
    21 <xsd:complexType name="vtopolanType">
     21  <xsd:complexType name="visnodeType">
     22    <xsd:annotation>
     23      <xsd:documentation>
     24        Node in the visualization of a federated experiment (Emulab
     25        legacy).  Fields include the local hostname of the node, x,y
     26        coordinates in a 2-dimensional representation, and whether the
     27        node in the visualization is a host or a LAN.
     28      </xsd:documentation>
     29    </xsd:annotation>
     30    <xsd:sequence>
     31      <xsd:element name="name" type="xsd:string"/>
     32      <xsd:element name="x" type="xsd:int"/>
     33      <xsd:element name="y" type="xsd:int"/>
     34      <xsd:element name="type" type="xsd:string"/>
     35    </xsd:sequence>
     36  </xsd:complexType>
     37
     38  <xsd:complexType name="vtopolanType">
    2239    <xsd:annotation>
    2340      <xsd:documentation>
     
    3754    </xsd:sequence>
    3855  </xsd:complexType>
     56
    3957}}}
    4058
    41 translates into a python dict like:
     59translate into python dicts like:
    4260
    4361{{{
    44 vlantopoType = {
     62vtoponodeType = {
     63  'vnode': 'name',
     64  'ips': '10.1.1.1,10.1.2.1',
     65}
     66
     67vtopolanType = {
    4568  'vname': 'string',
    4669  'vnode': 'string2',
     
    5275}}}
    5376
     77A complex type that includes another element that is a sequence simply includes a dict keyed by the element name.
    5478
     79Some elements are repeated multiple times in a type, or are optional, as noted by the {{{maxOccurs}}} and {{{minOccurs}}} attributes.  Elements that have {{{maxOccurs="1"}}} and {{{minOccurs="0"}}} defined in the XSD are optional fields and may either occur in the sequence/dict or not.  Elements with {{{maxOccurs="unbounded"}}} and {{{minOccurs="0"}}} defined in the XSD are repeated elements.  If none appear, the key is missing from the dict, if one or more are present the value mapped to the element name in the dict is a list of hashes, one for each copy of the repeatable element present.
     80
     81For example, the {{{vtopoType}}} from [source:wsdl/trunk/fedd_types.xsd fedd_types.xsd] includes a pair of repeated elements.  It is defined in XSD as:
     82
     83{{{
     84  <xsd:complexType name="vtopoType">
     85    <xsd:annotation>
     86      <xsd:documentation>
     87        The virtual topology of a federated experiment (Emulab legacy).
     88      </xsd:documentation>
     89    </xsd:annotation>
     90    <xsd:sequence>
     91      <xsd:element name="node" type="tns:vtoponodeType" minOccurs="0"
     92        maxOccurs="unbounded" />
     93      <xsd:element name="lan" type="tns:vtopolanType" minOccurs="0"
     94        maxOccurs="unbounded"/>
     95    </xsd:sequence>
     96  </xsd:complexType>
     97}}}
     98
     99An example of that datatype that only