Adapted from http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=51&t=004355:
Download the latest JAXWS Release Implementation (RI) from https://jax-ws.dev.java.net/ri-download.html. Unpack its jars as per instructions.
Tomcat 5.5
- copy the jaxws jars to the shared/lib directory in tomcat.
- move the jaxb-api.jar in shared/lib to common/endorsed.
- start tomcat
- create a shared directory in tomcat.
- copy the jaxws jars to that directory.
- create an endorsed directory in tomcat. If you are running tomcat using an ant task make sure you include the option
-Djava.endorsed.dirs=${catalina}/endorsed
- Move jaxb-api.jar from shared to endorsed.
- Edit conf/catalina.properties and set the shared.loader property as follows:
shared.loader=${catalina.home}/shared/*.jarWar
In the war, we update the web.xml to use a special listener that enables the web service. The web.xml should look like this:
<listener>Create a sun-jaxws.xml file in WEB-INF directory which the listener uses to configure itself with the web service you want to expose:
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>MyExampleService</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyExampleService</servlet-name>
<url-pattern>/example</url-pattern>
</servlet-mapping>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">After starting tomcat you can access the service by:
<endpoint name="MyExampleService" implementation="moten.david.example.ws.MyExample" pattern="/example"/>
</endpoints>
http://localhost:8080/{war-name}/example
No comments:
Post a Comment