In src package, code the following java code in file Server:
package com;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "Server")
public class Server {
/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Sum")
public int Sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a+b;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Subtract")
public int Subtract(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a-b;
}
}
2. In file index in web package, code the following:
package com;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "Server")
public class Server {
/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Sum")
public int Sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a+b;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Subtract")
public int Subtract(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a-b;
}
}
package com;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "Server")
public class Server {
/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Sum")
public int Sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a+b;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Subtract")
public int Subtract(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a-b;
}
}
2. In file index in web package, code the following:
package com;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "Server")
public class Server {
/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Sum")
public int Sum(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a+b;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Subtract")
public int Subtract(@WebParam(name = "a") int a, @WebParam(name = "b") int b) {
//TODO write your implementation code here:
return a-b;
}
}