Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a web service in android?

Can any one tell what exactly meant by web service in anddroid. Every where am able to find how to call webvservice using different protocols. but am not understanding what exactly a web service.

like image 971
android Avatar asked Dec 26 '22 20:12

android


2 Answers

Web Services are similar to web pages in the sense that you access them over the web using HTTP. The difference is that you are typically getting raw data back instead of a presentation page. For example you might get a row of records back like addresses. So the transport layer is HTTP. The data for Android is typically going to be encoded in JSON, or XML. And you can access the service using HttpClient or URLConnection. Often you can test a web service in a browser to see what you are getting back and you will usually see JSON or XML formatted data. For JSON you use a library like simple_json to extract into java object. XML is usually processed using a SAX Parser. They are really quite easy to use.

like image 91
Code Droid Avatar answered Jan 08 '23 20:01

Code Droid


A Web Service, in Android, is just like any other computer, a request for information over HTTP.

"Web Services can convert your application into a Web-application" (from w3schools.com) means that your can use Web Services to provide a richer and more up-to-date experience. For example if your application is a text editor it could check a web services for updates rather than force the user to check a website for updates. Another example is writing your own client to Facebook which would use several Web Service calls and depend on Facebook for content to present to the user.

like image 34
Dan S Avatar answered Jan 08 '23 19:01

Dan S