Foros de discusión
acces json web services liferay 6.2
Manuel Mancipe, modificado hace 10 años.
acces json web services liferay 6.2
New Member Mensajes: 24 Fecha de incorporación: 2/08/10 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, modificado hace 10 años.
RE: acces json web services liferay 6.2
Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
json.service.auth.token.enabled=false
Keep this property in portal-ext.properties
Keep this property in portal-ext.properties
meera prince, modificado hace 10 años.
RE: acces json web services liferay 6.2
Liferay Legend Mensajes: 1111 Fecha de incorporación: 8/02/11 Mensajes recientes
Hi
use some thing like this
http://test@liferay.com:test@localhost:8080/api/jsonws
Go through following link
https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/json-web-services
https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/remotely-accessing-liferay-services-liferay-portal-6-2-user-guide-18--2
https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/using-web-services-for-remote-portlets-wsrp-
http://www.liferaysavvy.com/2013/11/liferay-custom-json-web-services-on.html
use some thing like this
http://test@liferay.com:test@localhost:8080/api/jsonws
Go through following link
https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/json-web-services
https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/remotely-accessing-liferay-services-liferay-portal-6-2-user-guide-18--2
https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/using-web-services-for-remote-portlets-wsrp-
http://www.liferaysavvy.com/2013/11/liferay-custom-json-web-services-on.html
Manuel Mancipe, modificado hace 10 años.
RE: acces json web services liferay 6.2
New Member Mensajes: 24 Fecha de incorporación: 2/08/10 Mensajes recientes
Greetings to all
I implemented the solution http://test@liferay.com:test@localhost:8080/api/jsonws and work
Thank you,
I implemented the solution http://test@liferay.com:test@localhost:8080/api/jsonws and work
Thank you,
meera prince, modificado hace 10 años.
RE: acces json web services liferay 6.2
Liferay Legend Mensajes: 1111 Fecha de incorporación: 8/02/11 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>
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, modificado hace 10 años.
RE: acces json web services liferay 6.2
Junior Member Mensajes: 74 Fecha de incorporación: 5/10/10 Mensajes recientesManuel 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, modificado hace 9 años.
RE: acces json web services liferay 6.2
Junior Member Mensajes: 75 Fecha de incorporación: 20/04/13 Mensajes recientesAbhed 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"
Juliana Myaki, modificado hace 10 años.
RE: acces json web services liferay 6.2
New Member Mensajes: 2 Fecha de incorporación: 8/10/13 Mensajes recientes
Use the following annotation on the method declaration (on your ServiceImpl.java class).
You can also put the same annotation on you ServiceImpl class declaration, but it's not recommended.
@AccessControlled(guestAccessEnabled=true)
public String myServiceMethod(String myParam){
// my method code here
}
You can also put the same annotation on you ServiceImpl class declaration, but it's not recommended.
Ankur Srivastava, modificado hace 8 años.
RE: acces json web services liferay 6.2
Junior Member Mensajes: 58 Fecha de incorporación: 9/11/08 Mensajes recientesJuliana Myaki Bueno:
Use the following annotation on the method declaration (on your ServiceImpl.java class).@AccessControlled(guestAccessEnabled=true) public String myServiceMethod(String myParam){ // my method code here }
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 Paul Handa, modificado hace 8 años.
RE: acces json web services liferay 6.2
Liferay Master Mensajes: 541 Fecha de incorporación: 1/12/08 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.
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.