I do not know how xml-rpc works but it should be very similar. I use an LWP agent to post the following for create users in perl with the REST api.
my $params = {
'wstoken' => $token,
'wsfunction' => 'moodle_user_create_users',
'users[0][username]' => $self->username,
'users[0][firstname]' => $self->firstname,
'users[0][lastname]' => $self->lastname,
'users[0][email]' => $self->email, so on and so forth
}
the $url looks something like 'http://moodleserver/webservice/rest/server.php'
yours will most likely be 'http://moodleserver/webservice/XML-RPC/server.php'
the LWP post then goes - $response = $userAgent->post($url, $params);
and your can print $response->content to see what you get back or just do a check for $response->is_success or !$response->is_success.
for enrol users my params look like
$params = {
'wstoken' => $token,
'wsfunction' => 'moodle_enrol_manual_enrol_users',
'enrolments[0][roleid]' => $self->userid,
'enrolments[0][courseid]' => $self->courseid,
'enrolments[0][roleid]' => $self->roleid,
}
where roleid is the id of the role such as Student = 5, Teacher = 8 or whatever.
You can also go into the functions and change the parameters that they accept. I have made delete courses by shortname and id, get users by id and username, enrol users by coursename and username, ect and am in the process of posting them to the dev forums in several tickets.
I have not used role_assign but looking at the params it takes in enrol/manual/externallib.php I am going to guess it will be
'assignments[0][roleid]' => "38", #all of these should be ints unless you
'assignments[0][userid]' => "15", # change the function
'assignments[0][contextid]' => "15",
Let me know if I can help any other way, I hope these work for XML-RPC too as well as they do for REST
Richard Gillette
www.omnibond.com