role_assign assigns a role to a user but do not enrol a user in a course. You need to learn about context in Moodle if you want to use role_assign: http://docs.moodle.org/23/en/Context. Your error mentions that you can not assign the role to the context. You will also need to read: http://docs.moodle.org/23/en/Roles_and_capabilities
But really, most of the time what people want to use is an enrol web service function. See enrol_manual_enrol_users web service functions.