Android始终显示500错误

时间:2017-05-02 06:32:39

标签: android android-volley

我尝试使用POST方法跟踪网址。

网址:https://www.rampinteractive.com/api/app/sendmessage/313b4042-3bb3-4e2d-ad42-fd9103ebcdd9/32/-1/-1

方法:POST

参数:消息

但是它的表单数据请求。它的工作正常是PostMan Google Client。检查附加的屏幕截图。但在Android中它显示500错误。请帮帮我。

enter image description here Android代码:

Map<String, String> data = new HashMap<String, String>();
                data.put("message", edit_usedid.getText().toString().trim());                callAPI("https://www.rampinteractive.com/api/app/sendmessage/313b4042-3bb3-4e2d-ad42-fd9103ebcdd9/32/40940/1", data, APItype.CUSTOMER_LOGIN);

Android响应:

    05-02 12:05:57.298 26211-26211/com.syzygy.extreme.sdealscustomer I/System.out: CUSTOMER_LOGIN URL is https://www.rampinteractive.com/api/app/sendmessage/313b4042-3bb3-4e2d-ad42-fd9103ebcdd9/32/40940/1
05-02 12:05:57.299 26211-26211/com.syzygy.extreme.sdealscustomer I/System.out: Content-Type : text/html; charset=utf-8
05-02 12:05:57.299 26211-26211/com.syzygy.extreme.sdealscustomer I/System.out: message : fsdfdsfsd
05-02 12:05:57.594 26211-26744/com.syzygy.extreme.sdealscustomer E/Volley: [316] BasicNetwork.performRequest: Unexpected response code 500 for https://www.rampinteractive.com/api/app/sendmessage/313b4042-3bb3-4e2d-ad42-fd9103ebcdd9/32/40940/1
05-02 12:05:57.595 26211-26211/com.syzygy.extreme.sdealscustomer I/System.out: onErrorResponse-CUSTOMER_LOGIN- null

1 个答案:

答案 0 :(得分:0)

我认为问题在于你的RequestProperty:

内容类型:text / html;字符集= UTF-8

您应该将其设置为 application / json

@Override
public Map<String, String> getHeaders() throws AuthFailureError {
       Map<String, String> headers = new HashMap<>();
       headers.put("Content-Type", "application/json");
       return headers;
}