0% found this document useful (0 votes)
2K views

Web Services Lab Manual

1. Copy JAX-WS JAR files to the JDK and Tomcat lib directories. 2. Create a folder structure for the web service code and compile the Java classes. 3. Deploy the compiled classes and configuration files to Tomcat to make the web service endpoint available at http://localhost:8080/JAX-WS-Tomcat/sayhello.

Uploaded by

Nuha Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Web Services Lab Manual

1. Copy JAX-WS JAR files to the JDK and Tomcat lib directories. 2. Create a folder structure for the web service code and compile the Java classes. 3. Deploy the compiled classes and configuration files to Tomcat to make the web service endpoint available at http://localhost:8080/JAX-WS-Tomcat/sayhello.

Uploaded by

Nuha Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1)Hello World

Steps:
1.Copy the jax jars to the jdk and tomcat lib



2)create the folder structure in the drive where jdk is configured.

WebServiceInterface.java
package com.enterprise.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.RPC)
public interface WebServiceInterface {

@WebMethod
String printMessage();


}
WebServiceImpl.java
package com.enterprise.ws;

import javax.jws.WebService;

@WebService(endpointInterface = "com.enterprise.ws.WebServiceInterface")
public class WebServiceImpl implements WebServiceInterface{

@Override
public String printMessage() {
return "Hello";
}

}
4)
Compile code

5)In Tomcat create the following structure

5)Place the compiled classes in ws folder
6)Below web.xml and sun-jaxws.xml in WEB_INF
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
<listener>
<listener-class>

com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>sayhello</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>sayhello</servlet-name>
<url-pattern>/sayhello</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
Sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
<endpoint name="WebServiceImpl"
implementation="com.enterprise.ws.WebServiceImpl"
url-pattern="/sayhello" />
</endpoints>
7)in META_INF place the following file
MANIFEST.MF
Manifest-Version: 1.0
Class-Path:
8)create a war

9) start tomcat

http://localhost:8080/JAX-WS-Tomcat/sayhello

You might also like