def request(method, params)
      req = { "jsonrpc" => "2.0", "id" => Barrister::rand_str(22), "method" => method }
      if params
        req["params"] = params
      end
      
      # We always validate that the method is valid
      err_resp, iface, func = @contract.resolve_method(req)
      if err_resp != nil
        return err_resp
      end
        
      if @validate_req
        err_resp = @contract.validate_params(req, func)
        if err_resp != nil
          return err_resp
        end
      end
      
      # This makes the request to the server
      resp = @trans.request(req)
      
      if @validate_result && resp != nil && resp.key?("result")
        err_resp = @contract.validate_result(req, resp["result"], func)
        if err_resp != nil
          resp = err_resp
        end
      end
      
      return resp
    end
def request(method, params)
      req = { "jsonrpc" => "2.0", "id" => Barrister::rand_str(22), "method" => method }
      if params
        req["params"] = params
      end
      
      # We always validate that the method is valid
      err_resp, iface, func = @contract.resolve_method(req)
      if err_resp != nil
        return err_resp
      end
        
      if @validate_req
        err_resp = @contract.validate_params(req, func)
        if err_resp != nil
          return err_resp
        end
      end
      
      # This makes the request to the server
      resp = @trans.request(req)
      
      if @validate_result && resp != nil && resp.key?("result")
        err_resp = @contract.validate_result(req, resp["result"], func)
        if err_resp != nil
          resp = err_resp
        end
      end
      
      return resp
    end
Sends a JSON-RPC request.  This method is automatically called by the proxy classes,
 so in practice you don't usually call it directly.  However, it is available if you
 wish to avoid the use of proxy classes.

 * `method` - string of the method to invoke. Format: "interface.function".
              For example: "ContactService.saveContact"
 * `params` - parameters to pass to the function. Must be an Array