Below we will provide a short tutorial about how to expose some services that you have developed in Liferay as web services. The procedure is quite straight forward and so you can easily migrate your existing classes
  1. First you have to add in your libraries (jaxws-api.jar, jaxws-rt.jar,jaxws-tools.jar)
    if you plan to deploy jax-ws web servvices to clean tomcat you also need these libaries
  2. Create a java class with the methods you want
  3. Add some annotation to your methods as the following example:
    @WebService(endpointInterface = "com.ext.portlet.test.Helper")
    public class HelperImpl {

    @WebMethod String sampleMethod(String field);
  4. Create sun-jaxws.xml under WEB-INF folder with the following content

    <?xml version="1.0" encoding="UTF-8"?>
    <endpoints version="2.0" xmlns="">
    <endpoint implementation="com.ext.portlet.test.HelperImpl" name="HelperImpl" url-pattern="/HelperImpl"/>



  5. Add jaxws listener to web.xml
  6. Create a servlet reference in web.xml

    and the appropriate servlet mapping

  7. Restart Liferay and the wsdl is accessible through http://localhost:port/HelperImpl?wsdl


By admin