First of all, I do not have any code written yet, I am only in the design/thinking phase, so I’m doing some research on how to do what I want to do, this post is to get some bearings before I start coding.
So, I want to make an application that takes some info along with an image (from the camera preferably) and uploads it to a database in my test computer, and maybe to a dedicated server later on.
What I’m thinking is to make some web services, including a transfer service, so I can download and upload the images from and to my database, the database is MongoDB a No-SQL database (No-RDBMS). This database is based around documents, which makes the queries super-fast, and storing binary files stops being an issue.
But, and here’s my first question: Is it good to upload/download a file using a web service? especially for mobile devices?. If not what can I use, if it’s not an issue, what framework should I use (I’m thinking Axis2), and why. I will try to make the file size the smallest possible using some libraries to improve transfer times.
The second question would be if is is better to make a batch upload at specific times of day, or upload the files immediately after the operations are finished on the device?, I know this is a simple question, but this is a quest of enlightenment and I want to know, especially on mobile devices what is best.
Now, What kind of stream should I use for the upload/download? I’ve been reading, and converting an image to a byte array consumes a lot of CPU, and I don’t want my application to be sluggish, but this is the easiest way. Then there’s using DataHandlers for the transfer, but it seems complicated but not so harsh on the CPU (If I’m wrong, please do correct me on anything I say here), so I don’t know what to use.
Thanks for your time, and for reading this wall of text, but I’m trying to improve my skills, so any help would be greatly appreciated.
Edit
I found this thread extremely useful for what I’m trying to do:
Yes, You can, Using web service you can easily upload/download a file from server. But you have to do scrpting ar server side also (Use PHP, .net, etc..). It also useful to you for future use, just you have to change the address for server.
You can achieve as per your need and availability of network and also the operation number with file to upload. You can do it in background (using AsyncTask, Service, Thread etc..)while your application is running so I think there is no overhead to your frontend activity.
This also depends on how you maintain data on server or operate data on server. If you have use direct file (there is one apache library available) in request of webservice to upload download I think You don’t have to complex work for converting data in ByteArray, (but I think in background its happen).
Hope now your work done.