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)
def get_info_wb(url): client = suds.client.Client(url) service = client.service method_list = get_method_wb(client) print "method_list--->", method_list sd = [] for s in client.wsdl.services: print s sp = ServiceDefinition(client.wsdl, s) sd.append(sp) print "service:", sd # parameters excel = Datadriver.ExcelSheet(r"Employee.xlsx", "Sheet3") for method in method_list: #Get the number of the function param_number = get_param_no_wb(method) print "param_number--->", param_number param_list = [] init_no = 1 #which line of parameter-file for i in range(param_number): param_list.append(excel.cell(init_no,"p"+str(i+1))) print param_list print "method : %s" %(method) if param_number == 0: status = service.method print status elif param_number > 0: if param_number == 1: status = service.method(param_list[0]) elif param_number == 2: status = service.method_list[1](param_list[0], param_list[1]) print status elif param_number == 3: status = service.method(param_list[0], param_list[1], param_list[2]) elif param_number == 4: status = service.method(param_list[0], param_list[1], param_list[2], param_list[3]) elif param_number == 5: status = service.method(param_list[0], param_list[1], param_list[2], param_list[3], param_list[4]) else: print "Should change function to handle more parameters...." else: print "Error of parameter list" return status init_no += 1 if init_no > excel.nrows(): break continue print client.last_received()
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)
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)