Tengo un servicio web con postman funciona mas que bien y me arroja este resultado:
{ "apellido": "Ortiz", "tel": 7878, "usuario": "DioShaw", "nombre": "Yisus", "idUser": 1, "pswd": 123, "puntos": 1250 }
pero en el android studio esto: parece que acortara mi url quitando APistrping/v1 y la manda directo con 192.168.0.1/Login
y Este otro error aplicando el metodo try catch
E/response-success: >> java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonObject.toString()' on a null object reference
Este es mi servicio
Mi clase como principal en el android studio
public void vamoaello(){ //creating the json object to send JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("usuario","dios"); // Using the Retrofit IRetrofit jsonPostService = ServiceGenerator.createService(IRetrofit.class, "http://192.168.0.3:8080/APIspring/v1/"); Call<JsonObject> call = jsonPostService.postRawJSON(jsonObject); Log.d(">>>> 82", jsonObject.toString()); call.enqueue(new Callback<JsonObject>() { @Override public void onResponse(Call<JsonObject> call, Response<JsonObject> response) { Log.e(">>> a", "er"+response.raw()); Log.e(">>> e", "er"+response.raw().body()); Log.e(">>> e", "er"+response.raw()); Log.e(">>> e", "er"+response.toString()); // Log.e(">>> e", "er"+response.body().toString()); } @Override public void onFailure(Call<JsonObject> call, Throwable t) { Log.e(">>> e", t.toString()); } }); } }
mi interfaz