A Webservice Add-on is an object that responds directly to a request at the website.
To create a Webservice, first create an Add-on and add it to the site with the Add-on Manager. In this example, I will call the Add-on "SampleAddon". The SampleAddon will simply respond with the Message "Hello World".
Upload the Add-on to the Add-on Manager, and hit your site with:
?webservice=SampleAddon
The site will respond with "Hello World".
Your add-on code can read any other arguments from the querystring or submitted form, and change its output accordingly