Message Boards
call custom portlet webservice
mokhtar hatampoor, modified 4 Years ago.
call custom portlet webservice
Junior Member Posts: 31 Join Date: 12/27/07 Recent Posts
hi
i develop club portlet (custom portlet) in liferay 6.1 CA.
addScore method in ScoreServiceImpl is responsible to add score for remote systems (this method is web service method).
in this method i check permission. this method is:
public long addScore(long companyId,long groupId,long definitionId,String nationalCode,long score,String description)
throws PortalException, SystemException {
ClubPortletPermission.check(getPermissionChecker(), groupId, ActionKeys.WS_UPDATE);
// code for add score
}
in tomcat-users.xml i add this line:
<user username="10197" password="102030" roles="users"/>
for call this webservice i request this url:
http://userId:password@mydomain/club-portlet/api/secure/jsonws/score/add-score?companyId=10155&groupId=10181&definitionId=382604&nationalCode=4432300582&score=7&description=rrrr
when i request this url in permission check error occur:
in JSONServlet class :
remoteUser for portal webservices correctly return userId (that pass by URL), but with custom portlet URL remoteUser is null and this is root cause.
help me.
tanks
i develop club portlet (custom portlet) in liferay 6.1 CA.
addScore method in ScoreServiceImpl is responsible to add score for remote systems (this method is web service method).
in this method i check permission. this method is:
public long addScore(long companyId,long groupId,long definitionId,String nationalCode,long score,String description)
throws PortalException, SystemException {
ClubPortletPermission.check(getPermissionChecker(), groupId, ActionKeys.WS_UPDATE);
// code for add score
}
in tomcat-users.xml i add this line:
<user username="10197" password="102030" roles="users"/>
for call this webservice i request this url:
http://userId:password@mydomain/club-portlet/api/secure/jsonws/score/add-score?companyId=10155&groupId=10181&definitionId=382604&nationalCode=4432300582&score=7&description=rrrr
when i request this url in permission check error occur:
{"exception":"com.liferay.portal.security.auth.PrincipalException"}
if i don't check permission, addscore work correctly.in JSONServlet class :
String remoteUser = request.getRemoteUser();
remoteUser for portal webservices correctly return userId (that pass by URL), but with custom portlet URL remoteUser is null and this is root cause.
help me.
tanks
David H Nebinger, modified 4 Years ago.
RE: call custom portlet webservice
Liferay Legend Posts: 14914 Join Date: 9/2/06 Recent Posts
You're trying to mix tomcat authentication and Liferay authentication, those two things are completely different.