Laliwala IT Services

Laliwala IT Services
Website Development

Thursday, March 31, 2011

Liferay tutorial web service


 Liferay tutorial web service
Liferay update service 
Liferay book



===============================================================
7. Exposing the method as a web service
===============================================================
7.1 update service.xml
----------------------
specify remote-service="true" (default)
difference between local service and remote service.
Needless to say, once you do any modifications to service.xml file, please run "ant build-service"
7.2 updating service layer class - 2
------------------------------------
(file location - ext\ext-impl\src\com\ext\portlet\library\service\impl\BookServiceImpl.java)
public Book create(String title)
throws PortalException, SystemException, RemoteException {
return bookLocalService.create(title, "abcd");
}
(insert the additional import statements required to compile this class,)
import com.ext.portlet.library.model.Book;
import java.rmi.RemoteException;
import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
Important: Dont forget to re-generate the service layer after inserting this method into BookServiceImpl.java
7.3 steps to expose as a web-service
------------------------------------
a. go to "/ext/ext-impl"
b. execute "ant build-wsdd -Dservice.file=src/com/ext/portlet/library/service.xml"
c. make sure the build is successful
d. from ext level run "ant deploy"
e. re-start the server
g. make sure our new web-service is listed out and hence exposed.
h. in subsequent sessions we'll see how to consume this web-service from any other application.
Excercise:
Expose the getAllBooks method as a web service.

No comments:

Post a Comment