@Nelson,
In OKTech ws there are many oprations to assign/remove role to users into courses such as :
- function affect_user_to_course($client, $sesskey, $userid, $courseid, $rolename)
- function remove_user_from_course($client, $sesskey, $userid, $courseid, $rolename)
these two functions expects a Moodle userid, a Moodle course id and a role shortname (teacher,student, editingteacher...)
for the three legacy roles you can also use
- public function add_student($client,$sesskey,$courseid,$courseidfield,$userid,$useridfield)
- public function remove_student($client,$sesskey,$courseid,$courseidfield,$userid,$useridfield)
- public function add_teacher($client,$sesskey,$courseid,$courseidfield,$userid,$useridfield)
- public function add_noneditingteacher($client,$sesskey,$courseid,$courseidfield,$userid,$useridfield)
- ...
that expects a couple of values to uniquely identify the course (by id, idnumber or shortname) and the target user (by username,id,idnumer or email) such as :
add_student(client,sesskey,'chem101','idnumber','jdoe','username')
or
remove_teacher(client,sesskey,'12345','idnumber','jdoe@somewhere.com','email')
...
all these functions returns an affectRecord() with a boolean status and an eventual error message.
see the javadoc here : http://prope.insa-lyon.fr/~ppollet/moodlews/java/javadoc2/fr/insa_lyon/prope/moodle_195/wspp/wsdl2/Mdl_soapserverBindingStub.html
to get sample code in java see http://docs.moodle.org/dev/Web_Services:OK_Tech_Web_Services#Writing_a_client_in_Java for use with many java libraries such as Axis 1.4, Ksoap2 or Gson.
Cheers.