1) First create a client project and make sure that you have following jars in your client project and server Project
activation.jar
axis-1.4.jar
commons-collections-3.1.jar
commons-discovery-0.2.jar
commons-io-1.3.1.jar
commons-logging.jar
jaxrpc.jar
mail.jar
saaj.jar
utility.jar
webserviceutils.jar
wsdl4j-1.5.1.jar
xercesImpl.jar
xmlsec.jar
2) create class that invokes and call the webservice in Client project
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import javax.xml.namespace.QName;
public class Client {
public static void main(String[] args) {
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName(endpoint, "addtwonumbers"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
System.out.println("In the Try"+call);
Integer ret = (Integer) call.invoke(new Object[] {
new Integer(10), new Integer(11) });
System.out.println("addInt(5, 7) = " + ret);
} catch (Exception e) {
System.err.println("Execution failed. Exception: " + e);
e.printStackTrace(); }
}
}
3) Create Destined project to be webserviced
public class AddFunction {
public int addInt(int a, int b){
return (a+b);
}}
4)Copy the AddFunction Class and Rename with (.jws) extention
5)Right click onthe AddFunction class ->New->others->Webservices->wsdl
7) Deploy the server project in required server