简体   繁体   English

Android客户端连接到RestFul Web服务

[英]Android Client connecting to RestFul Webservice

hello All I have been fed up of looking for a simple example of rest webservice connecting to Android Application. 你好,我已经在寻找一个简单的REST Web服务连接到Android应用程序的简单例子。 I know so many people have asked this question before, but there are so many different answers as a theory. 我知道以前有很多人问过这个问题,但是从理论上讲,有很多不同的答案。 I know I must use restful web-service, rather than SOAP for mobile applications. 我知道对于移动应用程序,必须使用静态Web服务,而不是SOAP。 I need to create a webservice which is producing JSON, then in Android I can parse the JSON, but the problem is that as I am new to android I am looking for a simple example with both Server and client. 我需要创建一个生成JSON的Web服务,然后在Android中我可以解析JSON,但是问题在于,由于我是Android新手,所以我正在寻找一个包含服务器和客户端的简单示例。 A server : JAVA with Database connection and Restful WebService that produce JSON Android Client : which parse the JSON result from the webservice 服务器:具有数据库连接的Java和具有Restful Web服务的JAVA,可生成JSON Android Client:可解析来自Web服务的JSON结果

please if somebody can provide such a example , please please help me. 如果有人可以提供这样的例子,请帮助我。

Firstly, before you create your own web service, you might like to experiment with existing web services, such as those provided by Yahoo. 首先,在创建自己的Web服务之前,您可能想尝试使用现有的Web服务,例如Yahoo提供的服务。

Have a look at the PlaceFinder API by Yahoo, its a free web service you can call, and is quite well documented. 看看Yahoo的PlaceFinder API,它是一个免费的网络服务,您可以调用它,并且有据可查。 You can find the JSON examples here 您可以在此处找到JSON示例

Create a simple, standard java app that queries that web service, deals with JSON then System.out.print something from the response, that will get you familiar with what you need before you bring the android platform into the question 创建一个简单的标准Java应用程序,该应用程序查询该Web服务,处理JSON,然后从响应中进行System.out.print的打印,这将使您熟悉将android平台带入问题之前的需求

I haven't used the JSON examples, but I've written a quick tutorial on the XML side which may be of help. 我没有使用JSON示例,但是我已经在XML方面写了一个快速的教程 ,可能会对您有所帮助。 Once you're comfortable with this, introduce that code into an Android application and get it to print something on the screen. 一旦您对此感到满意,就可以将该代码引入Android应用程序中,并在屏幕上打印一些内容。

You have quite a broad set of requirements in your question, please try what I've recommended then come back with refined further questions 您的问题有很多种要求,请尝试我的建议,然后再提出进一步的问题

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM