I'd like to create a personnel project with a Java-coded server, and one HTML/JS client (with a framework to determine) and one Android client.
I'd like to be able to call Java method from those two clients with only one implementation. Which approach could I use?
I have thought about Websocket, but It seems I can only send messages, and then the server side has to parse it and make a method call itself. That's doable, but I'd like to find a better solution.
Using AJAX (that I never really used) seems to have the same issue. A http request is sent, but I will need a sort of parser to read the request and dispatch it.
I know servlets can do the work, but I often head this is really old-school. I don't know why, though.
I'm really open to any proposition to implement this client-server communication.
EDIT: The ideal solution I'd like to find would be anything that would enable a direct method call on server from client side. A great solution would be, for example, being able to call webservices from Javascript, or finding a framework with which I can make a direct remote call to a Java method.