Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package ctu.mimdw.services;
- import java.util.Date;
- import javax.jws.WebService;
- import javax.jws.WebMethod;
- import javax.jws.WebParam;
- @WebService(serviceName = "SimpleService")
- public class SimpleService {
- /**
- * Web service operation
- */
- @WebMethod(operationName = "currentdate")
- public String currentdate() {
- return new Date().toString();
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "capitalize")
- public String capitalize(@WebParam(name = "string") String string) {
- return string.toUpperCase();
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "sqrt")
- public double sqrt(@WebParam(name = "number") double number) {
- return Math.sqrt(number);
- }
- /**
- * Web service operation
- */
- @WebMethod(operationName = "compute")
- public String compute(@WebParam(name = "operator") char operator, @WebParam(name = "first") double first, @WebParam(name = "second") double second) {
- switch (operator) {
- case '+':
- return first + " + " + second + " = " + (first + second);
- case '-':
- return first + " - " + second + " = " + (first - second);
- case '*':
- return first + " * " + second + " = " + (first * second);
- case '/':
- return first + " / " + second + " = " + (first / second);
- }
- return "BAD OPERAND! Allowed operands are +,-,*,/";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement