class MBeanHelper {

    public String invoke(ObjectName bean, String operation, String... params) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, MBeanException {
        MBeanInfo mbinfo = mserver.getMBeanInfo(bean);
        MBeanOperationInfo op = null;
        for(MBeanOperationInfo oi: mbinfo.getOperations()) {
            if (oi.getName().equalsIgnoreCase(operation) && oi.getSignature().length == params.length) {
                if (op != null) {
                    throw new IllegalArgumentException("Ambiguous " + operation + "/" + params.length + " operatition signature for " + bean);
                }
                op = oi;
            }
        }
        if (op == null) {
            throw new IllegalArgumentException("Operation " + operation + "/" + params.length + " not found for " + bean);
        }
        Object[] args = new Object[params.length];
        String[] sig = new String[params.length];
        for(int i = 0; i != params.length; ++i) {
            args[i] = convert(params[i], op.getSignature()[i].getType());
            sig[i] = op.getSignature()[i].getType();
        }
        return format(mserver.invoke(bean, op.getName(), args, sig), op.getReturnType());
    }

    public  MBeanHelper(MBeanServerConnection connection);

}