예제 #1
0
    def __init__(self, username, password, source='', wsdl_url=None, **kwargs):
        if not wsdl_url:
            wsdl_url = docmail.client.DOCMAIL_WSDL
        self.source = source
        self.username = username
        self.password = password

        self.return_format = 'XML'
        self.failure_return_format = 'XML'

        options = Options()
        options.transport = HttpAuthenticated()
        self.options = options
        options.cache = MemCache()
        self.set_options(**kwargs)
        reader = DefinitionsReader(options, Definitions)
        self.wsdl = reader.open(wsdl_url)
        plugins = PluginContainer(options.plugins)
        plugins.init.initialized(wsdl=self.wsdl)
        self.factory = Factory(self.wsdl)
        self.service = ServiceSelector(self, self.wsdl.services)
        self.sd = []
        for s in self.wsdl.services:
            sd = ServiceDefinition(self.wsdl, s)
            self.sd.append(sd)
        self.messages = dict(tx=None, rx=None)
예제 #2
0
 def load(self, definitions):
     """ Load the object by opening the URL """
     url = self.location
     log.debug('importing (%s)', url)
     if '://' not in url:
         url = urljoin(definitions.url, url)
     reader = DefinitionsReader(definitions.options, Definitions)
     d = reader.open(url)
     if d.root.match(Definitions.Tag, wsdlns):
         self.import_definitions(definitions, d)
         return
     if d.root.match(Schema.Tag, Namespace.xsdns):
         self.import_schema(definitions, d)
         return
     raise Exception('document at "%s" is unknown' % url)
예제 #3
0
 def __init__(self, url, **kwargs):
     options = Options()
     options.transport = HttpAuthenticated()
     self.options = options
     options.cache = MemCache()
     self.set_options(**kwargs)
     reader = DefinitionsReader(options, Definitions)
     self.wsdl = reader.open(url)
     # uncomment this for 0.4+
     #        plugins = PluginContainer(options.plugins)
     #        plugins.init.initialized(wsdl=self.wsdl)
     self.factory = Factory(self.wsdl)
     self.service = ServiceSelector(self, self.wsdl.services)
     self.sd = []
     for s in self.wsdl.services:
         sd = ServiceDefinition(self.wsdl, s)
         self.sd.append(sd)
     self.messages = dict(tx=None, rx=None)
예제 #4
0
 def __init__(self, url, **kwargs):
     """
     @param url: The URL for the WSDL.
     @type url: str
     @param kwargs: keyword arguments.
     @see: L{Options}
     """
     options = Options()
     options.transport = HttpAuthenticated()
     self.options = options
     options.cache = ObjectCache(days=1)
     self.set_options(**kwargs)
     reader = DefinitionsReader(options, Definitions)
     self.wsdl = reader.open(url)
     plugins = PluginContainer(options.plugins)
     plugins.init.initialized(wsdl=self.wsdl)
     self.factory = Factory(self.wsdl)
     self.service = ServiceSelector(self, self.wsdl.services)
     self.sd = []
     for s in self.wsdl.services:
         sd = ServiceDefinition(self.wsdl, s)
         self.sd.append(sd)
     self.messages = dict(tx=None, rx=None)