1 Reply Latest reply on May 13, 2010 4:38 PM by Phillip Davey

    Example of a Servlet Web service on Glassfish

    Phillip Davey Newbie

      I was trying to put together a non-EE webservice (war deployment) in glassfish, but I couldn't find any examples of what to do so eventually I pieced together some stuff and thought I'd share it. 

      This is not what I actually wrote, it is an example based off of it, so if you find things that would make this not compile or error, it's because this hasn't been run. 

      If you have any improvements or suggestions, let me know...I've not done much with webservices.

      • Webservice

      @WebService(name="AnyNameSimpleWebService", serviceName="simpleWebService")
      public class SimpleWebService implements SimpleRemote //interface w/ response() declared
          public String raiseEvent(String event) {
           try {
                return "Event raised";
           catch (Exception e) {
                return e.getMessage();

      • Handler Chain (in root of classpath /WEB-INF/classes)

      <?xml version="1.0" encoding="UTF-8"?>
      <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">

      • web.xml