需要 Android 应用程序的工作流程创意
我计划编写一个 Android 应用程序,可以查看和更新本地网络 Oracle DB 上的数据。
我已经编写了一个 python 脚本,它每隔几分钟检查一次 oracle 数据库并写出 XML 文件,然后我计划通过我的 android 应用程序解析这些文件以显示数据。
正如我所提到的,只有当 Android 设备属于同一网络(本地连接或通过 VPN 连接)时,这才有效,并且 XML 将存储在 Unix 服务器上。
问题是如何使用 android 应用程序访问 Unix 服务器?我可以通过 Android 应用程序使用 FTP,还是应该更改 python 脚本以将 XML 发送到易于检索的位置?
编辑为了澄清你的意思,你有一个在tomcat之类的东西上运行的Web服务,客户端发送请求以从oracle数据库获取数据(也可以使用某种形式的身份验证),Web服务响应并以某种格式(XML、JSON 等)发送数据,然后客户端将请求发送回 Web 服务以更改 oracle 数据库上的某些数据,然后客户端进行竞价?
I'm planning on writing an android app that can view and update data on a local network Oracle DB.
I have already written a python script which checks the oracle db every couple of minutes and writes out XML files which I then plan to parse through my android app to display the data.
As I mentioned though this will only work if the android device is part of the same network (either connected locally or through a vpn), and the XML will be stored on a Unix server.
The question is how to access that Unix server with the android app? Can I use FTP via an android app, or should I be looking to change the python script to send the XML to an easily retrievable location?
EDIT To clarify what you mean, you have a web service running on something like tomcat, the client sends a request to get the data from the oracle db (can also use some form of authentication), the web service responds and sends the data in a format (XML, JSON etc.), the client then sends a request back to the web service to change some data on the oracle db, and in turn it does the clients bidding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,您会创建一个 网络服务向移动客户端提供数据。造成这种情况的原因有几个:
Web 服务是通过 HTTP/HTTPS 访问的,HTTP/HTTPS 是一种标准协议,并保证在所有网络上都能工作。企业 WiFi 网络因锁定除 Web 和电子邮件之外的协议而臭名昭著。
与静态 XML 文件相比,Web 服务具有动态创建响应的优势。这意味着数据将是最新的。
Web 服务可以获取一些输入参数并根据此参数创建响应。
身份验证:这是在 Web 服务中实现用户名/密码身份验证的常见方法,特别是在您提供一些私有数据时。
更新:
REST 是一种非常流行的 Web 服务类型。查看 Python 中的一些实现:Python REST(Web 服务)框架的建议?< /a>
Normally you would create a web service to provide data to mobile clients. There are several reasons for this:
Web services are accessed via HTTP/HTTPS which is a standard protocol and is guaranteed to work on all networks. Corporate wifi networks are especially notorious for locking down protocols except for web and email.
Web services compared to static XML files have an advantage of creating response on the fly. Which means that data will be current.
Web services can take some input parameters and create response based on this parameters.
Authentication: it is a common approach to implement username/passord authentication in the web service, especially if you serve some private data.
Update:
REST is a very popular type of web service. Look at some implementations in Python: Recommendations of Python REST (web services) framework?
这本书对我帮助很大:http://oreilly.com/catalog/9780596529260
REST 是一种设计您的网络服务。比你我聪明得多的人已经预见到,在网络上运行某些东西所需的所有工作都可以通过 HTTP 状态代码、HTTP 动词(如 POST、GET、DELETE、PUT 等)和清晰的层次结构的组合来处理资源(名词)。这听起来非常有限,但是当它们一起工作时,它非常漂亮。
查看 Facebook Open Graph API (developers.facebook.com),了解正确的 REST 服务是什么样的。
This book helped me a lot: http://oreilly.com/catalog/9780596529260
REST is a way of designing your web service. Folks much more intelligent than you and me have divined that all of the work needed for something to work on the net can be handled through a combination of HTTP status codes, HTTP verbs like POST, GET, DELETE, PUT etc. and a clear hierarchy of resources (nouns). It sounds very limiting but it's quite beautiful when it all works together.
Have a look at the Facebook Open Graph API (developers.facebook.com) to get an idea of what a proper REST service looks like.