Log in as admin
Go to course and enable self enrolment (With firebug note self_enrolment instance id)
Try enrol as student in that course and you should be able to self enrol.
As admin change self enrolment settings and add enrolment key
Try enrol as another student and it should ask for enrolment key.
Input enrolment key and it should enrol this user.
Test webservice (refer attached rest-ws-client)
Enable webservices and test enrol_self_enrol_user with enrolinstanceid =
{above instance id}