Fórumok

How to deploy a JAXWS web service in Liferay 6.1.x

karkaletsis karkaletsis, módosítva 10 év-val korábban

How to deploy a JAXWS web service in Liferay 6.1.x

New Member Bejegyzések: 23 Csatlakozás dátuma: 2005.01.29. Legújabb bejegyzések
I have created a class that I want to expose as JAX-WS service in a portlet.
I have done the following:
1. I have used WebService and WebMethod Annotation like this

@Override
@WebMethod
public
String sayHello(String a) {
// TODO Auto-generated method stub
return "11";
}
2. Create sun-jaxws.xml to define the endpoints
<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="com.ext.portlet.test.HelperImpl" name="HelperImpl" url-pattern="/HelperImpl"/>
</endpoints>

3. Create servlet mapping and references in web.xml

<servlet>
<servlet-name>HelperImpl</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>HelperImpl</servlet-name>
<url-pattern>/HelperImpl</url-pattern>
</servlet-mapping>

4. Add Listener in web.xml for

<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>

Redeployed portlet but I am getting error listener start

What is the problem. Isn't possible to deploy jaxws web service from within portlet plugin
thumbnail
Pierpaolo Cira, módosítva 10 év-val korábban

RE: How to deploy a JAXWS web service in Liferay 6.1.x

Regular Member Bejegyzések: 141 Csatlakozás dátuma: 2010.02.26. Legújabb bejegyzések
I think it isn't the best way to expose a service.
You can find a way to expose a service... but in this way you lose the liferay running context...

The best way is to use the Service layer provided by LR.
It is often tought like a way to access to a DB from the code... but using it you are able to expose remote service (both using db or not) also.

Try to read this introduction... https://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/service-build-2

In the official guide you can read "Liferay’s developers use a tool called Service Builder to expose their services via SOAP automatically. If you’re interested in using Service Builder, check out the Service Builder chapter in this guide." This is the link: https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/service-builder-liferay-portal-6-1-dev-guide-en
...and the point 9 is what you should need: https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/writing-the-remote-service-class-liferay-portal-6-1-dev-guide-en

Bye
karkaletsis karkaletsis, módosítva 10 év-val korábban

RE: How to deploy a JAXWS web service in Liferay 6.1.x

New Member Bejegyzések: 23 Csatlakozás dátuma: 2005.01.29. Legújabb bejegyzések
Can this be achieved without using database tables. I mean I use service builder to build web services that manipulate the tables. Now I want some services that have to be exposed as ws without having to deal with db
thumbnail
Pierpaolo Cira, módosítva 10 év-val korábban

RE: How to deploy a JAXWS web service in Liferay 6.1.x

Regular Member Bejegyzések: 141 Csatlakozás dátuma: 2010.02.26. Legújabb bejegyzések
Sure you can!!!
As I wrote "you are able to expose remote service (both using db or not)"