JAX-WS (Java API for XML Web Services) provides support for annotating Java classes with metadata to indicate that the Java class is a Web service. With the annotations, you can expose java classes as web services with minimum effort. Apache Axis2 ships with JAX-WS support since its 1.4 release. This post explains the simplest possible scenario of JAX-WS support, how you can deploy an annotated class in Axis2. Pre-requisites Apache Axis2-1.4 or later JDK1.5 or above Step 1 Write an annotated class as follows. package org.apache.axis2; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class Calculator { @WebMethod public double Add(double x, double y){ return x+y; } } Here, the @WebService annotation tells the server runtime to expose all public methods on the above class as a Web service. Also, with the @WebMethod annotation, you can specifically denotes the methods which are exposed in the web service. Step 2 Package the above class as a JAR (
Comments