JsonRequest with SSL
balduzzi85 opened this issue · 2 comments
balduzzi85 commented
Hi,
i try to do simple JsonRequest with TLS/SSL and i write this code:
// Replace R.raw.clienttruststore with your trust keystore in this import server cert
InputStream trustKeyStore = getResources().openRawResource(R.raw.clienttruststore);
// Replace R.raw.client with your client keystore
InputStream keyStore = getResources().openRawResource(R.raw.client);
RequestQueue queue = Volley
.newRequestQueue(Act_JsonRequest.this,
new ExtHttpClientStack(new SslHttpClient(trustKeyStore, "secret", 443, keyStore)));
JsonObjectRequest myReq = new JsonObjectRequest(Method.GET,
"https://192.168.1.4:8443/REST/app/generali/getA",null,
createMyReqSuccessListener(),
createMyReqErrorListener()){
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return createBasicAuthHeader("1", "2");
}};
queue.add(myReq);
}
});
But not work, if i try with StringRequest work..but i want Json..you have any idea?
GustavoFRGomes commented
Hello there I am sorry, but is it resolved? Because I see you are a contributor but since it isn't marked as solved I am a bit confused.
ogrebgr commented
It should work but I am afraid I cannot test it...
The specific request JsonObjectRequest or StringRequest does not matter. The important part is to create a HttpClient with the certificate loaded...