저는 Restful Web Service에 연결하고 JSON 응답을 얻고 있습니다.json 응답 안드로이드 오류가있는 Https 게시물 요청
내가 요청을 보내고 JSON 객체의 응답을 처리 할 수 있어요,하지만 문제는 오류받을 수 있습니다 :
Invalid api_key(is a parameter that I send,but I am sure is right).
당신이 문제의가 있는지 이해하는 데 도움 주실를 내 코드 또는 WEB에서? postParameters.add(new BasicNameValuePair("api_key", "apy_key"));
당신이 주어진 apiKey에 두 번째 피연산자를 교체 :
HttpClient httpClient = new DefaultHttpClient();
httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("SSLSocketFactory", SSLSocketFactory.getSocketFactory(), 443));
HttpPost request = new HttpPost();
request.setHeader("Content-type", "application/json, charset=utf-8");
request.setHeader("Accept", "application/json");
URI targetUri = new URI(TARGET_URL);
request.setURI(targetUri);
List<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("api_key", "api_key"));
postParameters.add(new BasicNameValuePair("user[email]", email));
postParameters.add(new BasicNameValuePair("user[password]",pwd));
Log.i("","EMAIL REQUEST: "+email.toString());
Log.i("","PWD REQUEST: "+pwd.toString());
HttpEntity postEntity = new UrlEncodedFormEntity(postParameters,"UTF-8");
request.setEntity(postEntity);
Log.i("","Request header "+request.getRequestLine());
Log.i("","Request : " +EntityUtils.toString(request.getEntity()));
httpClient.execute(request, myResponseHandler);
구성표 생성자는 인수에서 구성표의 값을 사용합니다. 귀하의 경우, "https"가 아닌 "SSLSocketFactory". – njzk2
그런 다음 content-type application/json을 선언하고 있지만 실제로 application/x-www-form-urlencoded – njzk2
을 sendind하면 실행 결과와 관련이없는 것 같습니까? – njzk2