Monday, 14 September 2015

Using JSON Web Services with Liferay


Liferay Plugin Portal JSON Web Services :- Liferay support the REST API. By Using That we have to create restful web services and the data format of that is JSON.
Liferay internally supports to create JSON services. it already have many portal JSON web services, these are simple URL calls by using web services, we can get the JSON data and use any where to consume web services.

In this tutorial I am guiding you about the Plugin Portal Web Services of Liferay. you can see all portal JSON web service by accessing following URL.





To make a restful web services follow the following steps:-
1. create service.xml in your plugin portlet project.
service.xml
service.xml
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2&_0.dtd">
  3. <service-builder package-path="com.evon">
  4. <author>manish</author>
  5. <namespace>JSONService</namespace>
  6. <entity name="Student" local-service="true" remote-service="true">
  7. <!-- PK fields -->
  8. <column name="studentId" type="long" primary="true" />
  9. <!-- Other fields -->
  10. <column name="name" type="String" />
  11. <column name="address" type="String" />
  12. <!-- Order -->
  13. <order by="asc">
  14. <order-column name="name" />
  15. </order>
  16. </entity>
  17. </service-builder>
In above code we have created an entity Student and taken some fields like studentId, name and address then build your service.xml. We have seen that the all necessary files are automatically generated in your project after successful build of service.xml.
2. We need to write java method according to our requirement. We have to….


You can check more informative blogs and tutorials at java development blogs section and can also browse the java developer forum for posting and viewing latest questions on java development.

Apart from this, If you have any Php issue, you can post it at Php Questions and Answers Forum

No comments:

Post a Comment