2017-08-10 66 views
-2

我想提出Web服務調用使用volly 我的方法如下安卓排球GET方法參數

Map<String, String> MyData = new HashMap<String, String>(); 
     MyData.put(pam1, parm1value); 


     JSONObject parameters = new JSONObject(MyData); 
     System.out.println(parameters + " *** PRM");//this prints data 
     JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.GET, 
       "myurl", 
       parameters, new Response.Listener<JSONObject>() { 
      @Override 
      public void onResponse(JSONObject response) { 
       //TODO: handle success 
       System.out.println(response+"***"); 

      } 

     }, new Response.ErrorListener() { 
      @Override 
      public void onErrorResponse(VolleyError error) { 
       error.printStackTrace(); 
       //TODO: handle failure 
      } 
     }); 
     System.out.println("REQ "+jsonRequest+"");//not prints parms 
     Volley.newRequestQueue(ctx).add(jsonRequest); 

但是,運行應用程序,我得到了

[220] BasicNetwork.performRequest: Unexpected response code 500 for [my url] 

我也試圖與StringRequest與時hashmap的參數,但同樣的問題

+0

打印該URL並檢查它是否正確 –

+0

它在服務器端的問題。你可以檢查[this](https://www.w3.org/Protocols/HTTP/HTRESP.html)以獲取更多 –

+0

問題來自服務器端..檢查你的網址 –

回答