Create a simple Web Service : Web Services Annotations « Web Services SOA « Java Tutorial






import java.text.SimpleDateFormat;
import java.util.Calendar;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService()
public class Main {

  @WebMethod
  public String getTime() {

    Calendar calendar = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    return (sdf.format(calendar.getTime()));

  }

}








26.3.Web Services Annotations
26.3.1.The WebService annotation type elements
26.3.2.The WebMethod annotation type elements
26.3.3.The WebParam annotation type elements
26.3.4.The WebResult annotation type elements
26.3.5.Annotations Found in the javax.xml.bind.annotation Package
26.3.6.Create a simple Web Service
26.3.7.Developing Web Services Using JAX-WS