Development:Creating a web service and a web service function
From MoodleDocs
First you need to read and execute the administration manual Setting_up_a_web_service. Now you should be more familiar about how web services are set into Moodle.