Developing JAXWS Service for deployment in GlassFish/JEE 5 compliant container

In the newer version of JEE you can use annotations for creating Web Service, i wanted to try this feature so i did create this simple JAX WS service that takes name/part of the name of contact as input and return list of contacts with same last name. You can download the JAXWS service from here First i did create a class that looks like this

import java.util.List;

import javax.jws.*;
@WebService(name="ContactWS", serviceName="ContactWS", 
public class ContactWS {
  public List searchContact(String lastName) {
    ContactDAO contactDAO = new ContactDAOImpl();
    return contactDAO.searchContact(lastName);

The ContactWS class implements web service. The next step is to declare this class as servlet in web.xml like this

<web-app xmlns="" 

  <display-name>Contact Web Service</display-name>



Once the application is deployed in the GlassFish server you can access it by going to http://localhost:9000/ManageContactWS/contactws

No comments: