diff --git a/Namespaces.py b/Namespaces.py index 1574853..2d191f1 100755 --- a/Namespaces.py +++ b/Namespaces.py @@ -28,6 +28,7 @@ except: BIND_HTTP = "http://schemas.xmlsoap.org/wsdl/http/" BIND_MIME = "http://schemas.xmlsoap.org/wsdl/mime/" BIND_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/" + BIND_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/" class XMLNS: BASE = "http://www.w3.org/2000/xmlns/" diff --git a/WSDLTools.py b/WSDLTools.py index 65e4f28..37c5b6b 100755 --- a/WSDLTools.py +++ b/WSDLTools.py @@ -438,6 +438,26 @@ class Message(Element): if elemref is not None: part.element = ParseTypeRef(elemref, element) + def getElementDeclaration(self): + """Return the XMLSchema.ElementDeclaration instance or None""" + element = None + if self.element: + nsuri,name = self.element + wsdl = self.getWSDL() + if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].elements.has_key(name): + element = wsdl.types[nsuri].elements[name] + return element + + def getTypeDefinition(self): + """Return the XMLSchema.TypeDefinition instance or None""" + type = None + if self.type: + nsuri,name = self.type + wsdl = self.getWSDL() + if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].types.has_key(name): + type = wsdl.types[nsuri].types[name] + return type + def getWSDL(self): """Return the WSDL object that contains this Message Part.""" return self.parent().parent() @@ -681,6 +701,13 @@ class MessageRole(Element): return self.parent().parent().getWSDL() return self.parent().getWSDL() + def getMessage(self): + """Return the WSDL object that represents the attribute message + (namespaceURI, name) tuple + """ + wsdl = self.getWSDL() + return wsdl.messages[self.message] + def toDom(self, node): wsdl = self.getWSDL() @@ -1040,7 +1067,7 @@ class Port(Element): def getAddressBinding(self): """A convenience method to obtain the extension element used - as the address binding for the port, or None if undefined.""" + as the address binding for the port.""" for item in self.extensions: if isinstance(item, SoapAddressBinding) or \ isinstance(item, HttpAddressBinding): @@ -1577,13 +1604,6 @@ def callInfoFromWSDL(port, name): parts = message.parts.values() if parts: - # XXX no idea what this is for, but it breaks everything. jrb - #callinfo.setReturnParameter( - # parts[0].name, - # parts[0].element or parts[0].type, - # element_type = parts[0].element and 1 or 0 - # ) - #for part in parts[1:]: for part in parts: callinfo.addOutParameter( part.name, diff --git a/XMLSchema.py b/XMLSchema.py index 6377d50..b72f80b 100755 --- a/XMLSchema.py +++ b/XMLSchema.py @@ -88,8 +88,8 @@ class SchemaReader: reader = self.__readerClass() reader.loadDocument(file) schema = XMLSchema() - if base is not None: - schema.setBaseUrl(base) + if url is not None: + schema.setBaseUrl(url) schema.load(reader) self.__setIncludes(schema) self.__setImports(schema) diff --git a/logging.py b/logging.py index e3f3f0d..76ce6dc 100644 --- a/logging.py +++ b/logging.py @@ -16,6 +16,9 @@ class ILogger: return def error(self, *args): return + def setLevel(cls, level): + cls.level = level + setLevel = classmethod(setLevel) _LoggerClass = ILogger @@ -24,10 +27,12 @@ class BasicLogger(ILogger): self.msg, self.out = msg, out def warning(self, msg, *args): + if self.level < 1: return print >>self, self.WARN, self.msg, print >>self, msg %args WARN = 'WARN' def debug(self, msg, *args): + if self.level < 2: return print >>self, self.DEBUG, self.msg, print >>self, msg %args DEBUG = 'DEBUG' @@ -43,9 +48,22 @@ class BasicLogger(ILogger): def setBasicLogger(): + '''Use Basic Logger. + ''' + setLoggerClass(BasicLogger) + BasicLogger.setLevel(0) + +def setBasicLoggerWARN(): + '''Use Basic Logger. + ''' + setLoggerClass(BasicLogger) + BasicLogger.setLevel(1) + +def setBasicLoggerDEBUG(): '''Use Basic Logger. ''' setLoggerClass(BasicLogger) + BasicLogger.setLevel(2) def setLoggerClass(loggingClass): '''Set Logging Class.