vicropa
vicropa

Reputation: 11

How can I get Liferay user ID from a external servlet

I have a problem. I want to get Liferay user ID in a servlet that runs in another Tomcat, not in Tomcat on which Liferay runs. If both runs in same Tomcat, no problem, Liferay API works perfectly. But in this case, when I use 'UserLocalServiceUtil.decryptUserId' in order to decrypt user ID present in cookie, I get a 'BeanLocator is null' exception.

What can I do? Has this any solution?

Upvotes: 0

Views: 570

Answers (1)

Rushikesh Thakkar
Rushikesh Thakkar

Reputation: 723

You can consume Liferay's web services to get User details from Liferay from your servlet. You can choose from SOAP WebServices or JSON WebServices.

My recommendation in you scenario is to use JSON WebService - get-user-by-email-address method (like this: http://<host>:<port>/api/jsonws?signature=/user/get-user-by-email-address-2-companyId-emailAddress) to get User object, and get UserId from it.

Upvotes: 1

Related Questions