what is a web service in android?

血红的双手。 提交于 2020-01-01 12:32:21

问题


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.


回答1:


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.




回答2:


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.




回答3:


A web service is a standard used for exchanging information between applications or systems of heterogeneous type. Software applications written in various programming languages and running on various platforms can use web services to exchange information over Internet using http protocol. This inter-operability can be achieved between Java and Dot net applications, or PHP and Java applications.

For example, an android application can interact with java or .net application using web services.



来源:https://stackoverflow.com/questions/11799797/what-is-a-web-service-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!