Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Manuel Mancipe
acces json web services liferay 6.2
7 de enero de 2014 7:54
Respuesta

Manuel Mancipe

Ranking: New Member

Mensajes: 18

Fecha de incorporación: 2 de agosto de 2010

Mensajes recientes

Hi, I am trying to use the api http://localhost:8080/api/jsonws becasue i want to consume some services but I have some probem i got this message "Authenticated access required", I was investigating about the problem and we need to setup in the portal-ext.properties this sentence json.service.auth.token.hosts.allowed= but it does not working, I dont know why, can you help me? thanks. I am working with liferay 6.2 enterprise,
Pankaj Kathiriya
RE: acces json web services liferay 6.2
7 de enero de 2014 8:05
Respuesta

Pankaj Kathiriya

Ranking: Liferay Master

Mensajes: 697

Fecha de incorporación: 4 de agosto de 2010

Mensajes recientes

json.service.auth.token.enabled=false

Keep this property in portal-ext.properties
Juliana Myaki Bueno
RE: acces json web services liferay 6.2
20 de enero de 2014 11:13
Respuesta

Juliana Myaki Bueno

Ranking: New Member

Mensajes: 3

Fecha de incorporación: 8 de octubre de 2013

Mensajes recientes

Use the following annotation on the method declaration (on your ServiceImpl.java class).

1@AccessControlled(guestAccessEnabled=true)
2public String myServiceMethod(String myParam){
3    // my method code here
4}


You can also put the same annotation on you ServiceImpl class declaration, but it's not recommended.
Manuel Mancipe
RE: acces json web services liferay 6.2
5 de febrero de 2014 7:41
Respuesta

Manuel Mancipe

Ranking: New Member

Mensajes: 18

Fecha de incorporación: 2 de agosto de 2010

Mensajes recientes

Greetings to all

I implemented the solution http://test@liferay.com:test@localhost:8080/api/jsonws and work

Thank you,
Meera Prince
RE: acces json web services liferay 6.2
10 de febrero de 2014 23:10
Respuesta

Meera Prince

Ranking: Liferay Legend

Mensajes: 1110

Fecha de incorporación: 8 de febrero de 2011

Mensajes recientes

Hi
Use like this in Ajax call
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).on('ready',function(){
var username ="test@liferay.com";
var password ="test";
function make_base_auth(user, password) {
var tok = user + ':' + password;
var hash = btoa(tok);
return "Basic " + hash;
}
$.ajax({
url: 'http://localhost:8080/api/jsonws/country/get-countries',
dataType: "json",
data:{},
type: "get",
success: function(data){
alert(data[0].name);
},
beforeSend: function(xhr){
xhr.setRequestHeader('Authorization',make_base_auth(username, password));
},
complete: function(){
},
error: function(){
}
});

});
</script>
Abhed Dekavadiya
RE: acces json web services liferay 6.2
1 de abril de 2014 5:23
Respuesta

Abhed Dekavadiya

Ranking: Junior Member

Mensajes: 74

Fecha de incorporación: 5 de octubre de 2010

Mensajes recientes

Manuel Mancipe:
Greetings to all

I implemented the solution http://test@liferay.com:test@localhost:8080/api/jsonws and work

Thank you,



Hello Manuel,
I am trying this, but it's not working. Did you do any other configuration also ?
regards,
Abhed
Moisés Belda
RE: acces json web services liferay 6.2
16 de mayo de 2014 3:29
Respuesta

Moisés Belda

Ranking: Junior Member

Mensajes: 74

Fecha de incorporación: 20 de abril de 2013

Mensajes recientes

Abhed Dekavadiya:
Manuel Mancipe:
Greetings to all

I implemented the solution http://test@liferay.com:test@localhost:8080/api/jsonws and work

Thank you,



Hello Manuel,
I am trying this, but it's not working. Did you do any other configuration also ?
regards,
Abhed


If you want to test all json webservices (guest-allowed or not) with "http://localhost:8080/api/jsonws" API page list, you have to be logued in liferay portal. Try to open new browser tab with the same browser, put your user/pass, and then refresh API page list. Non-Guest methods will work without "Authenticated access required"
Ankur Srivastava
RE: acces json web services liferay 6.2
19 de mayo de 2015 13:08
Respuesta

Ankur Srivastava

Ranking: Junior Member

Mensajes: 58

Fecha de incorporación: 8 de noviembre de 2008

Mensajes recientes

Juliana Myaki Bueno:
Use the following annotation on the method declaration (on your ServiceImpl.java class).

1@AccessControlled(guestAccessEnabled=true)
2public String myServiceMethod(String myParam){
3    // my method code here
4}


You can also put the same annotation on you ServiceImpl class declaration, but it's not recommended.


Thanks for this information. Is there any documentation which provides more information on this ?
Jeffrey Handa
RE: acces json web services liferay 6.2
19 de mayo de 2015 14:03
Respuesta

Jeffrey Handa

LIFERAY STAFF

Ranking: Liferay Master

Mensajes: 501

Fecha de incorporación: 1 de diciembre de 2008

Mensajes recientes

Hi Ankur,

In addition to the JSON Web Services section of the official documentation, I'd recommend the recording of the Securing Remote Web Services dev.life session that Tomáš presented.