[Soap-Python] Extending simple types in pysimplesoap

Chris Beck cbeck at railkey.net
Fri Apr 17 20:50:35 CEST 2015


Hello all,
  I have an OTA (open travel alliance) WSDL that I am trying to call.  When
trying with a Suds implementation it works but uses >1.5 gigs of RAM to
initialize the client object. If anyone knows how to get an order of
magnitude shrinkage in Suds clients then please let me know and we can
ignore what follows.

I'm trying to see how well PySimpleSoap might serve as a replacement but I
seem to have hit a limitation.

The relevant imported XSDs (OTA_CommonTypes, OTA_SimpleTypes) for the WSDL
declares (apologies in advance if the formatting screws up plain text
readers - I worked on the assumption that the added clarity outweighed the
increasingly rare case):

<xs:complexType name="CountryNameType">
   <xs:annotation>
      <xs:documentation xml:lang="en">The name or code of a country
(e.g. as used in an address or to specify citizenship of a
traveller).</xs:documentation>
   </xs:annotation>
   <xs:simpleContent>
      <xs:extension base="StringLength0to64">
         <xs:attribute name="Code" type="ISO3166" use="optional">
            <xs:annotation>
               <xs:documentation xml:lang="en">ISO 3166 code for a
country.</xs:documentation>
            </xs:annotation>
         </xs:attribute>
      </xs:extension>
   </xs:simpleContent>
</xs:complexType>

and

<xs:simpleType name="StringLength0to64">
   <xs:annotation>
      <xs:documentation xml:lang="en">Used for Character Strings,
length 0 to 64</xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
      <xs:minLength value="0"/>
      <xs:maxLength value="64"/>
   </xs:restriction>
</xs:simpleType>

When parsing this I get an error:

File "{path}/lib/python2.7/site-packages/pysimplesoap/helpers.py", line
271, in process_element
    struct.refers_to = fn
TypeError: can't set attributes of built-in/extension type 'str'

which occurs in a recursive call to process_element after this chunk:

if e is not None and e.get_local_name() == 'extension' and e.children():
    # extend base element (if ComplexContent only!):
    if isinstance(fn, Struct) and fn.refers_to:
        base_struct = fn.refers_to
    else:
        # TODO: check if this actually works for SimpleContent
        base_struct = None


So I am guessing that the answer to the TODO is "No".

Has anyone encountered this kind of error before and determined a way
around it?

Cheers,
Chris
-- 
Christopher Beck
cbeck at railkey.net
+1.514.431.7759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20150417/3391ce06/attachment.html>


More information about the Soap mailing list