tags:

views:

147

answers:

1

I'm a newbie in web services. How can I develop a simple one on my Ubuntu box? Is there any packages I need to install first?

+1  A: 

Well since you didn't say what language or even what webservices try this:

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart

Goto /var/www/ create a file called hello.php

<?php
    echo "<webservice><hello>world</hello></webservice>";
?>

Goto http://localhost/hello.php and you already have a webservice returning some XML. That's how they all work (no matter what language you choose, ASP.NET is just better in hiding that).

Daff
Thanks dude. But how about is I want to use javascript? Is it the same packages and steps?
karikari
karikari
I don't know what you want to do with JavaScript. It is mainly a client side language, not for server side webservices (though there is a JavaScript server called Jaxer http://www.jaxer.org/). To be honset it seems to me that you should make yourself generally more familiar with web technologies, so that you can ask a more specific question.
Daff
For example, if I want my web service to process my HTTP parameters, means that I need to program the logics inside the PHP file ?
karikari
Yes. Your example can be processed by e.g. accessing $_GET['hosts'] which has the hosts= parameter from your http request in the PHP script.
Daff