如何从Web服务器发送接收数据?请 [英] How to send receive data from web server? Please

查看:330
本文介绍了如何从Web服务器发送接收数据?请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,





这些天我试图为Android制作一些应用程序。将三个字符串发送到Web服务器并接收中等数量的数据的应用程序。

我知道我该怎么做,但我需要服务器端的解释,所以这是我的问题。



我应该将Web服务器上的数据组织为数据库还是XML?我应该使用PHP从数据库中获取数据并将其发送到应用程序,还是应该将数据放入XML文件并读取它然后使用XSLT创建HTML文件并将该HTML文件发送到应用程序?

告诉我最好的方法,我在谷歌搜索,但我找不到好的解释。或者纠正我,如果我错了,我只是一名学生。



在我的应用程序中,我可以向列表中的用户数据显示,或者在WebView中显示所有相同的内容。 ..



谢谢!

解决方案

嗨Nemanja,



我将解释这些步骤...



最好使用JSON格式进行数据传输,因为它非常易读......



数据库应该在服务器中,可以通过Web服务或WCF访问...





1。数据库应放在可由Webservice / WCF访问的服务器中。

2。创建一个小的WCF或Web服务来访问来自其他远程应用程序的数据。

3. Web服务可以以JSON格式导出数据更容易(你可以得到很多json用于阅读和填充Listview或网格等的序列化和反序列化类。

4。您可以通过c访问Android应用中的数据在Java JSON序列化程序和反序列化程序类的帮助下,将这个Web服务和转换为List项目。

5。转换为List视图后,很容易传递给自定义Listview的适配器或默认适配器..



请让我知道这个解释是否正确或需要任何帮助...



谢谢,

Ullas Krishnan


您好,



请参阅下面链接的JSON字符串到Listview



http://codeoncloud.blogspot.in/2013/07/how-to-populate-android-list-view-from.html [ ^ ]





用Java创建REST完整服务...

http://crunchify.com/create-very-simple-jersey-rest-service-and-send-json-data-from-java-client/ [ ^ ]



我是一名在Xamarin中创建应用程序的C#开发人员,因此在Java中没有任何sampl示例。



有WCF和C#安卓样品....



谢谢,

Ullas Krishnan

Hello,


These days I was trying to make some app for Android. App that send three Strings to web server, and receive a medium size amount of data.
I know how can i do this, but i need an explanation for server side, so here is my question.

Should I organize data on web server as Database or XML? Should I use PHP to get data from Database and send it to an app, or should I put data in XML file and read it then create HTML file with XSLT and send to that HTML file to an app?
Tell me the best way to do it, i searched on google but i could not find good explanation. Or correct me if I am wrong, I am just a student.

In my app, I can show to user data in list, or in WebView all the same...

Thanks!

解决方案

Hi Nemanja,

I will explain the steps...

Its better to use JSON format for data transfer, because its very readable...

The database should be in a Server, which can be accessed by Web Service or WCF...


1. The database should be placed in a server which can be accessed by Webservice / WCF.
2. Create a small WCF or Webservice to access the data from other remote application.
3. The webservice can export the data in JSON format which is easier (you can get many json serialize and deserializ classes) for reading and populating Listview or Grid etc.
4. you can access the data from your Android app by calling this webservice and converting to List items with the help of Java JSON serializer and De-serializer classes.
5. After converting to List view its very easy to pass to custom adapter or default adapter for Listview..

please let me know is this explanation is ok or need any help...

Thanks,
Ullas Krishnan


Hi,

Please see the below link for the JSON String to Listview

http://codeoncloud.blogspot.in/2013/07/how-to-populate-android-list-view-from.html[^]


Create a REST FULL service in Java...
http://crunchify.com/create-very-simple-jersey-rest-service-and-send-json-data-from-java-client/[^]

I am a C# developer creating Application in Xamarin, so dont have any sampl example in Java.

Have WCF and C# Android Samples....

Thanks,
Ullas Krishnan


这篇关于如何从Web服务器发送接收数据?请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆