Why do we use web services
The power of web services is that they provide features that programmers can add to their applications regardless of the programming language used.
Example
For example, you might have a website on which you would like users to be able to punch their location, and your website returns the weather along with their location on Google maps. Google Maps and various weather sites provide web services, so web developers can use these features. If your site is encoded in Java, PHP or python, it does not matter.
Another example: if you have a business site, and you would like your site to display stock quotes daily. Various companies will provide stock web services so you can do this. Some are free and some are not.
SOAP and RESTful Web Services
In the end, you will need to discuss the difference between RESTful and SOAP web services, and this is a monumental discussion in itself. But a simple example of a calm web service to add two numbers below.
REST
http://www.SimpleMathSite.com/Add/5/6/
the site will return something like
<?XML version="1.0" encoding="utf-8"?> <answer> 11 </answer>
You can use this in your javascript or PHP code. If you look at the URL, you can see your call with the Add function and pass it the values ββ5 and 6. Thus, web services allow you to associate objects written in different languages ββwith each other.
SOAP
SOAP is much more complex, but the advantage is a WSDL file that describes all the remote functions that you can call. Because of this, some compilers allow you to import a web service and create objects that you can place in your code without having to see any complex XML that goes backstage. If there was a WSDL file in the above example, some compilers allowed you to import the web service so that you could use it in your code like this.
int Answer = SimpleMath.Add(5,6);
Check out this weather web service for a great example of using SOAP. It provides examples of HTTP GET and POST requests that you can use if you want to make your own SOAP client from scratch.
http://www.webservicex.com/globalweather.asmx?op=GetWeather
What if there were no web services?
Without web services, websites could not update their content with data coming from other websites, such as airline information, hotel vacancies, or whether your facebook friends liked the same song on Pandora