Tuesday, 15 January 2013
Creating WebService Using Liferay Service.xml
Steps to create webservice using liferay service.xml
1. Add remote-service="true" in service.xml for the perticular entity.
eg:
<entity name="Customer" local-service="true" remote-service="true" cache-enabled="false">
2. Build service. It will create <entityName>ServiceImpl.java file in XXX.portal.service.impl
eg:
CustomerServiceImpl.java in com.test.portal.service.impl.
3. Create a method in <entityName>ServiceImpl.java and return some value.
eg:
CustomerServiceImpl.java extends CustomerServiceBaseImpl{
public String getCustomerName(String customerName){
//TO DO, Write your logic here and based on logic return your details
return customerName;
}
}
4. Build service and web-service. It will create required classes. You can check your project entry in WEB-INF/server-config.wsdd.
eg:
<parameter name="allowedMethods" value="getSquareOf"/>
5. Check whether your web service is running fine or not by checking wsdl file.
eg:
http://localhost:8080/Customer-portlet/api/axis/Plugin_Customer_CustomerService?wsdl
Steps to validate webservice
6. Use service definition given in step 5 and create a webservice client.
or
7. Use any webservice testing tool to validate webservice.
eg:
http://storm.codeplex.com/
Labels:
liferay
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment