public function req_enrol_user(stdclass $user, stdclass $remotecourse) {
        global $CFG, $DB;
        require_once($CFG->dirroot.'/mnet/xmlrpc/client.php');

        $peer = new mnet_peer();
        $peer->set_id($remotecourse->hostid);

        $request = new mnet_xmlrpc_client();
        $request->set_method('enrol/mnet/enrol.php/enrol_user');
        $request->add_param(mnet_strip_user((array)$user, mnet_fields_to_send($peer)));
        $request->add_param($remotecourse->remoteid);

        if ($request->send($peer) === true) {
            if ($request->response === true) {
                // cache the enrolment information in our table
                $enrolment                  = new stdclass();
                $enrolment->hostid          = $peer->id;
                $enrolment->userid          = $user->id;
                $enrolment->remotecourseid  = $remotecourse->remoteid;
                $enrolment->enroltype       = 'mnet';
                // $enrolment->rolename not known now, must be re-fetched
                // $enrolment->enroltime not known now, must be re-fetched
                $DB->insert_record('mnetservice_enrol_enrolments', $enrolment);
                return true;

            } else {
                return serialize(array('invalid response: '.print_r($request->response, true)));
            }

        } else {
            return serialize($request->error);
        }
    }