V
V
Vitaly2014-05-05 12:02:36
Java
Vitaly, 2014-05-05 12:02:36

How to properly organize client-server communication?

I am writing a client server application. Works according to the standard scheme: Client <---> Server <---> DB. The server has methods for getting data from the database (eg getCost()).

How can I properly organize communication between the Client and the Server?

The only option that I came up with: after establishing a communication channel between the Client and the Server, the Client sends the Request object to the Server (with the fields Command, Object), for example. Request (getCost, Order), the Server receives this object, by the field the Command understands what it needs to do, executes a query to the database, forms the Response object (with the Object field) and returns the Response to the Client.

The server is written in Java, Client1 - Java, Client2 - Objective C (IOS (IPhone)).

Comment, please, and maybe you can tell me the right way to solve.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Smirnov, 2014-05-11
@bobzer

Apparently, the universal method of communication in a heterogeneous environment is HTTP/XML: both Java and Objective C can work with it. For example, here on stackoverflow there are a couple of words of theory. In my opinion, the main disadvantage is that for each action it will be necessary to develop a server-side method and make it available via HTTP. Various frameworks that try to simplify writing clients, for example, JSF in Java, do not have this drawback, but here the question arises of cross-platform - no matter how you have to produce separate development for each software client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question