Marcos Guimaraes Marcos Guimaraes - 10 months ago 266
Android Question

Android volley - Unexpected response code 500

I am trying to edit an already registered addresses on my application, but I'm getting this error when I try to do that.

Can somebody please help me out with this? Thanks in advance.

private void callServiceToEditAddress(String flatNo, String apartmentName, String landmark, String pincode) {

HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("id", addressID);
hashMap.put("flat_no", flatNo);
hashMap.put("apartment_name", apartmentName);
hashMap.put("lanmark", landmark);
hashMap.put("pincode", pincode);
hashMap.put("state", selectedState);
hashMap.put("city", ID_city);
hashMap.put("location", ID_locality);
hashMap.put("country", "2");

new VolleyHelper(getActivity()).post("editAddress/", hashMap, new Response.Listener<String>() {
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
String success = jsonObject.getString("success");
CroutonUtil.showCroutonMessage(getActivity(), success, CroutonUtil.CROUTON_STYLE_CONFIRM);
} catch (JSONException e) {

}, new Response.ErrorListener() {
public void onErrorResponse(VolleyError error) {

My Log cat:

E/Volley: [365] BasicNetwork.performRequest: Unexpected response code 500 for link I'm using

Answer Source

I was actually able to solve my problem eventually. What happened is that this web service that I am using "editAddress" also needed another field that I was not providing inside hashMap. I made the changes and it worked fine. I hope this helps anyone that is having the same issue.