我将所有字符串的数据发布到服务器中的varchar变量,但是我得到了凌空服务器错误或badnetwork性能错误417.
我使用以下功能来调用服务器,如果出现错误,请帮我解决。
public void signUpWS() {
avi.show();
StringRequest strReq = new StringRequest(StringRequest.Method.POST, Constants.SIGN_UP, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Snackbar.make(mainlayout, response.toString(), Snackbar.LENGTH_LONG).show();
Log.e("Responce from server", response.toString());
avi.hide();
if (!response.toString().contains("User")) {
spEdit.putString(getString(R.string.uaccount), response.toString());
spEdit.commit();
Intent intent = new Intent(SignUp.this, Products.class);
intent.putExtra(getString(R.string.uemail), Email_Address);
intent.putExtra(getString(R.string.uphone), Phone_Number);
intent.putExtra(getString(R.string.upass), Password);
startActivity(intent);
finish();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
avi.hide();
Log.e("Volley Error", error.toString());
if (error.toString().contains("NoConnectionError")) {
Snackbar.make(mainlayout, "Internet Not Available!", Snackbar.LENGTH_LONG).show();
} else {
Snackbar.make(mainlayout, "Webservice not responding!", Snackbar.LENGTH_LONG).show();
}
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json; charset=utf-8");
return headers;
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> data = new HashMap<String, String>();
String name[] = Name.split(" ");
String first = "", last = "";
boolean firstb = true;
for (int i = 0; i < name.length; i++) {
if (firstb) {
first += name[i];
firstb = false;
} else {
if (i == name.length - 1) {
last = name[i];
} else {
first += " ";
first += name[i];
}
}
}
data.put("FirstName", first);
data.put("LastName", last);
data.put("LoginName", Login_Name);
data.put("PrimaryEmail", Email_Address);
data.put("PrimaryPasscode", Encrypted_Password);
data.put("SecondaryPasscode", Encrypted_Password);
data.put("PhoneNumber", Phone_Number);
data.put("PrimaryCellNumber", Phone_Number);
data.put("AccountType", UserType);
data.put("ProfileRateSequence", "" + 0);
data.put("MemberShipType", "BASIC");
data.put("CityName", "null");
data.put("CountryId", "" + 0);
data.put("StateId", "" + 0);
data.put("IsVerified", "" + 1);
data.put("IsBlocked", "" + 0);
data.put("IsBlackListed", "" + 0);
data.put("IsActive", "" + 1);
data.put("IsDeleted", "" + 0);
return data;
}
};
AppController.getInstance().addToRequestQueue(strReq, REQ_TAG);
}[![The Error which i get on logcat.][1]][1]
答案 0 :(得分:0)
我没有传递一些参数,这些参数对于APi来说是强制性的,因此我得到了期望失败的错误。