background preloader

Android

Facebook Twitter

Designing For Android - Smashing Magazine. Java - Options for Client Server Communication in Android. Android Client – Server designs. Applications are usually designed so that a Server provides a service to a Client. Choosing an implementation depends on the requirements. Inside this article I will be explaining three implementation types: SOAPServletJSON I will use the Android application which was developed inside my previous post. Simple Object Access Protocol is basically designed to provide a lightweight mechanism to exchange data in a XML format. Setting up a SOAP web service isn’t al that difficult. There is a disadvantage of using SOAP, and that’s overhead. So lets set-up an implementation.

Create a server implementation publicclass Hello {publicString sayHello(String name){return"Hello "+ name;}} Create an Android implementationCreate a call to the server privatevoid callService(SoapSerializationEnvelope envelope){ HttpTransportSE androidHttpTransport =new HttpTransportSE(URL); Handle the response request.addProperty("name", text); envelope.setOutputSoapObject(request); callService(envelope); Servlet. Droid4me - Project Hosting on Google Code.