Anonymous avatar Anonymous 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.

Comments (0)

Files changed (4)

                     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):
         #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:
             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()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.