def send(self, target, params): target, category, service = self.parse_target(target) caller = self.choose_caller(target) if caller is None: raise Exception("Cannot connect to %s" % target) req_msg = XmlRequestGenerator(self.configuration, category, service, params) caller.send(target, req_msg.to_xml())
def call(self, target, params, timeout=300, reverse=False): target, category, service = self.parse_target(target) caller = self.choose_caller(target, reverse) if caller is None: raise Exception("Cannot connect to %s" % target) req_msg = XmlRequestGenerator(self.configuration, category, service, params) ret = caller.call(target, req_msg.to_xml(), timeout) resp_parser = XmlResponseParser() return resp_parser.parse(ret)
def call(self, target, params, timeout=300): target, category, service = self.parse_target(target) if target == self.configuration.node_name: raise Exception("Target is self, cannot do RPC %s.%s.%s" % (target, category, service)) if not self.ping(target): raise Exception("Cannot connect to %s" % target) caller = self.get_caller() req_msg = XmlRequestGenerator(self.configuration, category, service, params) ret = caller.call(target, req_msg.to_xml(), timeout) resp_parser = XmlResponseParser() return resp_parser.parse(ret)
def send(self, target, params): target, category, service = self.parse_target(target) caller = self.get_caller() req_msg = XmlRequestGenerator(self.configuration, category, service, params) caller.send(target, req_msg.to_xml())