Example #1
0
 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()
     plugins = PluginContainer(options.plugins)
     plugins.loaded(root=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)
Example #2
0
 def __init__(self, root, baseurl, options, container=None):
     """
     @param root: The xml root.
     @type root: L{sax.element.Element}
     @param baseurl: The base url used for importing.
     @type baseurl: basestring
     @param options: An options dictionary.
     @type options: L{options.Options}
     @param container: An optional container.
     @type container: L{SchemaCollection}
     """
     self.root = root
     self.id = objid(self)
     self.tns = self.mktns()
     self.baseurl = baseurl
     self.container = container
     self.children = []
     self.all = []
     self.types = {}
     self.imports = []
     self.elements = {}
     self.attributes = {}
     self.groups = {}
     self.agrps = {}
     plugins = PluginContainer(options.plugins)
     plugins.loaded(root=root)
     if options.doctor is not None:
         options.doctor.examine(root)
     form = self.root.get('elementFormDefault')
     if form is None:
         self.form_qualified = False
     else:
         self.form_qualified = ( form == 'qualified' )
     if container is None:
         self.build()
         self.open_imports(options)
         log.debug('built:\n%s', self)
         self.dereference()
         log.debug('dereferenced:\n%s', self)