Volley JSONException: Fin de l'entrée au caractère 0 de

J'ai vu d'autres viennent sur ce problème, mais aucun des postes ont été en mesure de m'aider. Je suis d'essayer d'utiliser de Volley de mon appel RESTE de la bibliothèque, et lorsque j'essaie d'utiliser un appel de Put avec un Objet JSON en tant que paramètre, je suis error with: org.json.JSONException: End of input at character 0 of.

Voici le code:

protected void updateClientDeviceStatus(Activity activity, final int status) {
JSONObject jsonParams = new JSONObject();
try {
jsonParams.put("statusId", String.valueOf(status));
} catch (JSONException e1) {
e1.printStackTrace();
}
Log.i(LOG_TAG, "json: " + jsonParams.toString());
String url = Constants.API_URL + "client/device/" + getDeviceId();
//Request a response from the provided URL.
JsonObjectRequest request = new JsonObjectRequest
(Request.Method.PUT, url, jsonParams, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.i(LOG_TAG, "updated client status");
Log.i(LOG_TAG, "response: " + response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.i(LOG_TAG, "error with: " + error.getMessage());
if (error.networkResponse != null)
Log.i(LOG_TAG, "status code: " + error.networkResponse.statusCode);
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String>  params = new HashMap<String, String>();
params.put("User-Agent", getUserAgent());
params.put("X-BC-API", getKey());
return params;
}
@Override
public String getBodyContentType() {
return "application/json";
}
};
request.setRetryPolicy(new DefaultRetryPolicy(20000, 3, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MySingleton.getInstance(activity).addToRequestQueue(request);
}
}

La jsonParams journal affiche:

json: {"statusId":"1"}

Est-il un autre réglage que je suis absent? Il semble que la demande ne peut pas analyser l'Objet JSON. J'ai même essayé de créer une table de hachage, puis l'utilise pour créer un Objet JSON, mais j'obtiens toujours le même résultat.

source d'informationauteur Mike Walker