3

I am planning to write a Web Service in Java which connects to a MySQL Database and computes and exposes different information from it.

Then an Android app will connect to this Web Service and process the information.

Initially I thought of using XML files, but I was advised that it is not the best-practice correct way, and the Service part will not be light weight. That I should use JSON.

What is the correct architecture and solution for my problem ?

Also is it possible to run a Java Web Service without Tomcat, directly by the JVM from a jar?

Any documentation or links would be helpful.

Mythul
  • 1,807
  • 7
  • 34
  • 53

2 Answers2

4

yes, for android its better to use JSON, its native API (built in) and its much lighter. also , its recommended to use RESTful service, for the same reasons (performance, lighter )

regarding the webservice without tomcat, i am not sure its possible, because you always need a container to manage and run your code.

here is a good tutorial to create RESTful service using Jersy.

http://www.vogella.com/tutorials/REST/article.html

the sample shows data as XML, you can change to JSON.

Yazan
  • 6,074
  • 1
  • 19
  • 33
1

You can use node.js. This will not require Tomcat or any other application server since it itself hots a HTTP server in itself.

https://blog.nodejitsu.com/a-simple-webservice-in-nodejs/

MySQL with Node.js

Community
  • 1
  • 1
Madhur Ahuja
  • 22,211
  • 14
  • 71
  • 124