Sergey A. Bozhenkov  committed b0edb23

1. fix bug with creation of classes with extensions. 2. fix anyType. AnyType will add type information on serialization and will use this information to perfom automatic deserialization. The list of known types is now global, i.e. is shared by all services.

  • Participants
  • Parent commits 5f8ce2e

Comments (0)

Files changed (4)

File osa/

                     detail = fault.find('detail')
                     if detail is not None:
                         detail = detail.text or ''
-                    raise RuntimeError("SOAP Fault %s:%s <%s> %s%s"\
+                    raise RuntimeError("SOAP Fault %s: %s <%s> %s %s"\
                             %(self.location,, code, string, detail))
         for schema in schemas:
             parser = xmlschema.XMLSchemaParser(schema)
-        return xmlschema.XMLSchemaParser.convert_xmltypes_to_python(xtypes)
+        types =  xmlschema.XMLSchemaParser.convert_xmltypes_to_python(xtypes)
+        xmltypes.XMLAny._types.update(types)
+        return types
     def get_messages(self, types):

File osa/

         #find sequence/choice/all
         seq = None
         for str in ("sequence", "all", "choice"):
-            seq = element.find("./{%s}%s" %(xmlnamespace.NS_XSD, str))
+            #note deep search here, this is necessary for
+            #extensions that look like
+            #complexType->complexContent->extensions->sequence
+            seq = element.find(".//{%s}%s" %(xmlnamespace.NS_XSD, str))
             if seq is not None:

File osa/

             for single in val:
                     single.to_xml(element, full_name)
+                    if child["type"] is XMLAny:
+                        #append type information
+                        element[-1].set("{%s}type" %xmlnamespace.NS_XSI, 
+                                "{%s}%s" %(single._namespace,
+                                           single.__class__.__name__) )
                 except Exception:
                     single = child['type'](single)
                     single.to_xml(element, full_name)
         type = element.get('{%s}type' %xmlnamespace.NS_XSI, None)
         if type is None:
             return element
-        type = xmlnamespace.get_local_name(type)
         type_class = self._types.get(type, None)
         if type_class is not None:
             res = type_class()
              # It looks like P29DT23H54M58S
              'duration'                                : XMLString,
              '{%s}duration' %xmlnamespace.NS_XSD       : XMLString}
+XMLAny._types = primmap.copy()