d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Could Someone Explain Web Services?
Add Reply New Topic New Poll
Member
Posts: 34,581
Joined: Mar 25 2009
Gold: 12,633.00
Dec 24 2015 06:09pm
Could someone explain what web services are and why I need to learn them for java, and how it works with in cooridnation to java? Would appreciate it.....
Member
Posts: 1,849
Joined: May 31 2008
Gold: 2,571.50
Dec 24 2015 10:19pm
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.

This post was edited by Noobtard on Dec 24 2015 10:21pm
Member
Posts: 34,581
Joined: Mar 25 2009
Gold: 12,633.00
Dec 24 2015 11:00pm
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! :)
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll