def download(self, options): """ download the schema """ url = self.location try: if '://' not in url: url = urljoin(self.schema.baseurl, url) reader = DocumentReader(options) d = reader.open(url) root = d.root() root.set('url', url) return self.schema.instance(root, url, options) except TransportError: msg = 'imported schema (%s) at (%s), failed' % (self.ns[1], url) log.error('%s, %s', self.id, msg, exc_info=True) raise Exception(msg)
def __init__(self, url, options): """ @param url: A URL to the WSDL. @type url: str @param options: An options dictionary. @type options: L{options.Options} """ log.debug('reading wsdl at: %s ...', url) reader = DocumentReader(options) d = reader.open(url) root = d.root() WObject.__init__(self, root) self.id = objid(self) self.options = options self.url = url self.tns = self.mktns(root) self.types = [] self.schema = None self.children = [] self.imports = [] self.messages = {} self.port_types = {} self.bindings = {} self.services = [] self.add_children(self.root) self.children.sort() pmd = self.__metadata__.__print__ pmd.excludes.append('children') pmd.excludes.append('wsdl') pmd.wrappers['schema'] = repr self.open_imports() self.resolve() self.build_schema() self.set_wrapped() for s in self.services: self.add_methods(s) log.debug("wsdl at '%s' loaded:\n%s", url, self)