Sending data from Android to WCF with REST

As it turns out Android has no support for SOAP. There are some 3rd party libraries e.g. ksoap2-android, but in general Google hasn't shown any interest in supporting Microsoft's innovation. So for my back-end I was forced to use RESTful service.

In Android there is a library called JSONObject which can be found in org.json.JSONObject. Using this object, we can serialize/deserialize JSON Objects.

Here is an example of how to put data in using JSONObject:

There are several libraries available to send the data. I used org.apache.http.client mostly, because it seemed the easiest.

Within that library we have a set of http methods: HttpPost, HttpPut, HttpHead etc. have a set of all necessary methods and functions to send data we want.

The code belows show how I used HttpPost along with JSONObject to send data to a WCF service

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box