2

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?

PDStat
  • 5,513
  • 10
  • 51
  • 86

2 Answers2

4

Normally you would create a web service to provide data to mobile clients. There are several reasons for this:

  1. 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.

  2. Web services compared to static XML files have an advantage of creating response on the fly. Which means that data will be current.

  3. Web services can take some input parameters and create response based on this parameters.

  4. 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?

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Hmmm that web service would still need access to the data though? So the python script would send the data to this web service in some format, and then the web service would make this available in another format to the Android app via authentication? I know little about this subject any specific areas you'd recommend me reading up on? – PDStat Feb 19 '11 at 17:44
  • Usually web service layer talks directly to the database. The format the webservice provides is usually XML or JSON, so you could possibly reuse some code from your script. The difference is that you would not save data to file, but run the code every time the webservice is invoked. – Peter Knego Feb 19 '11 at 19:33
  • On the Android (client) side both JSON and XML are well supported. JSON maybe a bit better as there is a GSON library which maps JSON directly to java objects: http://code.google.com/p/google-gson/ – Peter Knego Feb 19 '11 at 19:37
1

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.

Abhinav
  • 38,516
  • 9
  • 41
  • 49