tags:

views:

48

answers:

1

I'll be very simple:

I want to be able to store Java objects from the phone to a webserver. Then, I want to be able to retrieve them later.

What could be a good combination of tools/webservers/languages to achieve this?

I have done that before with a serialization of objects through a LAMP server.

Example [java object on the android phone] -> [object serialization] -> [POST request to PHP webserver ] -> [storage in a database]

Do you know any better and comfortable technique? Can I work directly with Java objects using a JSP/Servlet?

Thank you.

A: 

On the server side, you are welcome to use whatever you are comfortable with.

On the client side, for Android, I would recommend serializing to JSON instead of XML, simply because the org.json package supports creating JSON, and there are no classes in Android well-suited for creating XML.

You are welcome to use the Serializable interface in Java and convert your Java objects to byte arrays for storage and retrieval, but then you are locked into Java, which may not be a sound plan for future flexibility.

CommonsWare
Thanks for your advice.JSON over XML could be a good thing. Anyway, it's on the server side I'd like to get some hint. What could be a good choice?
daliz
You say in your post that you have used PHP before. Hence, you may as well use PHP now. For what you are describing, at the level you have described it, just about anything will work, so you may as well use something you are already comfortable with.
CommonsWare
So, would you agree with my way to work?Every object is disassambled in Strings and other variables, stored in a database and viceversa? Doesn't really matter what server-side language I'm using, because the technique would be the same in every language?I'm sorry if I keep asking the same thing with different words, but I really find uncomfortable, in an OOP age, to have to disassemble objects (and lose all the advantages of the OOP) to work remotely with objects. Thank you again.
daliz
"So, would you agree with my way to work? Every object is disassambled in Strings and other variables, stored in a database and viceversa?" -- I can't answer that, as it depends on your application. "but I really find uncomfortable, in an OOP age, to have to disassemble objects (and lose all the advantages of the OOP) to work remotely with objects" -- The day you find a remote object solution that works across dozens of different client platforms and dozens of different server platforms, use it. We'll have flying cars first, though.
CommonsWare
Ok. Very clear.Thanks ;)
daliz