2017-05-02 73 views
0

我尝试使用POST方法跟踪URL。Android始终显示500错误

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

方法:POST

参数:消息

但其形式数据请求。它的工作正常PostMan谷歌客户端。检查附加的屏幕截图。但在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 
+0

android中使用什么码? – NehaK

+0

@NehaK代码已更新。任何代码都可以。请帮帮我。 – PREMKUMAR

+0

@PREMKUMAR,你检查了这个:http://stackoverflow.com/questions/28135008/unexpected-response-code-500-for-post-method –

回答

0

我认为问题是在你RequestProperty:

的Content-Type:text/html的;字符集= UTF-8

你应该设置为应用/ JSON

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