Foros de discusión
android Jsonws URL
nicolas Roman Buitrago, modificado hace 7 años.
android Jsonws URL
New Member Mensajes: 3 Fecha de incorporación: 16/03/16 Mensajes recientes
Hi!
I'm trying to access json services in android through the library volley, like this:
And the result I get is:
{"message":"Authenticated access required","exception":"java.lang.SecurityException"}
I read about passing user credentials in the URL. "http://test&40liferay.com:test@192.168.0.2:8080/api/jsonws/user/get-user-by-id/user-id/21836"
but got the same result.
I also used the BasicAthentication of mobile SDK and LoginScreenlet of liferayScreens, obtaining the same.
how I can get the JSON result through the URL?
Thanks!
I'm trying to access json services in android through the library volley, like this:
final static String JSON_URL = "http://192.168.0.2:8080/api/jsonws/user/get-user-by-id/user-id/21836";
JsonObjectRequest jsObjRequest = new JsonObjectRequest
(Request.Method.GET,JSON_URL , null, new Response.Listener<jsonobject>() {
@Override
public void onResponse(JSONObject response) {
mTextView.setText("Response: " + response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText("That didn't work!");
mTextView.setText(error.toString());
}
});
</jsonobject>
And the result I get is:
{"message":"Authenticated access required","exception":"java.lang.SecurityException"}
I read about passing user credentials in the URL. "http://test&40liferay.com:test@192.168.0.2:8080/api/jsonws/user/get-user-by-id/user-id/21836"
but got the same result.
I also used the BasicAthentication of mobile SDK and LoginScreenlet of liferayScreens, obtaining the same.
how I can get the JSON result through the URL?
Thanks!
Javier Gamarra, modificado hace 7 años.
RE: android Jsonws URL
Expert Mensajes: 348 Fecha de incorporación: 12/02/15 Mensajes recientes
Have you tried adding a Basic Authentication Header like this?
The error basically says that the request is missing the auth header, it should work fine with the Mobile SDK though.
Can you try the link, if it fails I can do a quick check with volley...
The error basically says that the request is missing the auth header, it should work fine with the Mobile SDK though.
Can you try the link, if it fails I can do a quick check with volley...
nicolas Roman Buitrago, modificado hace 7 años.
RE: android Jsonws URL
New Member Mensajes: 3 Fecha de incorporación: 16/03/16 Mensajes recientes
It worked adding a Header.
Thank you very much!
Thank you very much!