Quote (Noobtard @ Dec 25 2015 12:19am)
A web service is a program that is hosted on some server somewhere.
1) Call a webservice from your java application, passing to it the information you want it to consume.
2) Get response from webservice.
So an example of when you would use a webservice would be:
Lets say you are designing an application and you need to send an email because of... reasons.
You could:
1) create the necessary logic to send an email
2) call a webservice that already has the logic to send an email and pass to it the 'content' you want the email to have.
So lets say you went with 2)
In your java application you would open up a connection and call an email web service, you pass to it the emails content. Than you will receive a response from the web service that you can decide what to do with. Web services consume and return mostly, xml/json/text.
I gave kind of an easy high level example. Basically if the functionality you want to achieve is already available in a web service, than use the web service and just create logic to deal with the response from the service.
Someone in my class called a webservice that he would feed an location and it would return a list of restaurants, its rating, prices, location, description, etc. Imagine if you had to create the logic to get that list, it's much easier to create logic to 'parse' or create objects from the response data...
I hope this helped. I'm not an expert - hopefully I get corrected if I was wrong.
Thanks man, that was a very good explanation, i understand now ty!
