Saturday, August 25, 2012

Thursday, August 23, 2012

Liferay Custom JSON Web Service Development



Following is the step by step description of generating a custom liferay plugin service and exposing it as JSON Web Service.



STEP:1 Create a liferay plugin project and create new service


Here is the sample service.xml



Make sure remote-service=”true” in entity tag declaration.



STEP:2  Build the service.



STEP:3  Add your custom method in SampleLocalServiceImpl class



STEP:4  Build the service.



STEP:5  Add the method definition to SampleServiceImpl class



STEP:6  build the service.



STEP:7  Add the following <servlet> and <servlet-mapping> Entries to portlet's web.xml file -



STEP:8  deploy the portlet.


STEP:9  To access your json web services enter the following url -

http://localhost:8080/<<portlet-context>>/api/jsonws





and Its Done!!!