James MV
James MV

Reputation: 8717

Android and Tomcat communication?

I'm writing an android application that will rely heavily on a tomcat server. Before I go to far I wanted to get some advice on how to setup the communication. There will be a wide range of requests for data sent by the application. What is the best method to implement this. Is it to serialize objects or is there a better way? A link to a good tutorial would be really appreciated.

Upvotes: 2

Views: 532

Answers (2)

sschrass
sschrass

Reputation: 7166

I am happy with RESTful web services. Then you have the freedom do develop the backend without having to think about the frontend too much. I recommend Jersey as REST API, there are some tutorials on the web (vogella.com to name one).

Upvotes: 2

Vion
Vion

Reputation: 569

I solve this in my applications in the following way:

First, I use a RestWebService (i.e., JAXRS reference implementation). This is the communication endpoint on the Tomcat Server.

Then the exchanging of messages can be done by using JSON Strings. They are well supported by Android and also JAXRS in combination with JACKSON allows to easily transform objects into JSON or to deserialize them. I usually write a JSON Object Library which contains all objects that should be available on both sides and include this Lib in both projects.

Upvotes: 2

Related Questions