droid4me.ws a is an extension of the Android droid4me framework which contains several web service caller implementation.
droid4me.ws consists of several parts :
- httpclient (deprecated) : an implementation based on the Apache HTTP client.
- okhttp : an implementation based on the Square HTTP client
- retrofit : an implementation based on the Retrofit library
Note : a default implementation based on the URLConnection is available into the droid4me framework.
Android 6.0 release removes support for the Apache HTTP client (source)
2. okhttp (wiki)
This implementation is based based on the Square HTTP client and exposes two classes :
OkHttpClientWebServiceCaller: this class extends the droid4me classWebServiceCallerand is responsible for computing the http client, performing the http request, managing the cache and managing errors.JacksonOkHttpClientWebServiceCaller: this class extendsOkHttpClientWebServiceCallerand implements the droid4me.ext interfaceObjectMapperComputer. It also provides anObjectMapperattribute (from the Jackson library) in order to parse JSON.
This implementation is based based on Retrofit library and exposes two classes :
RetrofitWebServiceCaller: this class is responsible for computing the http client, performing http requests via retrofitAPI, managing cache and errors.JacksonRetrofitWebServiceCaller: this class extendsRetrofitWebServiceCallerand provides anObjectMapperattribute (from the Jackson library) in order to parse JSON.
To add these implementations to your project, include the following in your app module build.gradle file:
dependencies
{
//okhttp
implementation ("com.smartnsoft:okhttpwebservicecaller:${latest.version}")
//retrofit
implementation ("com.smartnsoft:retrofitwebservicecaller:${latest.version}")
}For the okhttp implementation, ${latest.version} is
For the retrofit implementation, ${latest.version} is
This library is available under the MIT license. See the LICENSE file for more info.
This library was proudly made by Smart&Soft, Paris FRANCE
