Foros de discusión
Liferay 7 problem with jsonws
Hiếu Nguyễn, modificado hace 7 años.
Liferay 7 problem with jsonws
New Member Mensaje: 1 Fecha de incorporación: 27/10/16 Mensajes recientes
Hello everyone,
I am a newbie in Liferay and i have a problem with the jsonws:
My custom jsonws is not accessed through Postman without Authorization header.
I have a Liferay workspace with default sample service.
I add a method call sayHello in FooServiceImpl class:
In my src/main/resources/service-ext.properties
and in my workspace config/dev/portal-ext.properties i also add
Everything is good when i use http://localhost:8080/api/jsonws to test my jsonws
but when i try to access it with post man, i recieve
I have searched this problem with mr. google and in this forum for 3 days but have no solution work for me, anybody has experience about it , please help me !
Thanks
I am a newbie in Liferay and i have a problem with the jsonws:
My custom jsonws is not accessed through Postman without Authorization header.
I have a Liferay workspace with default sample service.
I add a method call sayHello in FooServiceImpl class:
package xxx.service.impl;
public class FooServiceImpl extends FooServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS:
*
* Never reference this class directly. Always use {@link xxx.service.FooServiceUtil} to access the foo remote service.
*/
@AccessControlled(guestAccessEnabled=true)
public Account sayHello(){
Account account = AccountLocalServiceUtil.fetchAccount(20118);
return account;
}
}
In my src/main/resources/service-ext.properties
Auth.token.check.enabled=false
json.service.auth.token.hosts.allowed=127.0.0.1,SERVER_IP
json.service.auth.token.enabled=false
jsonws.web.service.public.methods=*
jsonws.servlet.hosts.allowed=127.0.0.1,SERVER_IP
and in my workspace config/dev/portal-ext.properties i also add
lude-and-override=portal-developer.properties
json.service.auth.token.enabled=false
Auth.token.check.enabled=false
json.service.auth.token.hosts.allowed=127.0.0.1,SERVER_IP
jsonws.web.service.public.methods=*
jsonws.servlet.hosts.allowed=127.0.0.1,SERVER_IP
Everything is good when i use http://localhost:8080/api/jsonws to test my jsonws
but when i try to access it with post man, i recieve
{
"exception": "Access denied to vn.azteam.metricsystem.service.FooService#sayHello",
"throwable": "java.lang.SecurityException: Access denied to xxx.service.FooService#sayHello",
"error": {
"message": "Access denied to xxx.service.FooService#sayHello",
"type": "java.lang.SecurityException"
}
}
I have searched this problem with mr. google and in this forum for 3 days but have no solution work for me, anybody has experience about it , please help me !
Thanks
Daniele Baggio, modificado hace 7 años.
RE: Liferay 7 problem with jsonws
Expert Mensajes: 336 Fecha de incorporación: 5/12/08 Mensajes recientes
Same problem... ping!!!
Daniele Baggio, modificado hace 7 años.
RE: Liferay 7 problem with jsonws
Expert Mensajes: 336 Fecha de incorporación: 5/12/08 Mensajes recientes
This is the way, add an entry to specify your service class and methods.
https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/service-access-policies
I dont know how to setup this by code, I have to discover...
@baxtheman
https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/service-access-policies
I dont know how to setup this by code, I have to discover...
@baxtheman