Java tutorial
package com.liyablieva.jaxws.endpoint; import com.liyablieva.jaxws.model.Employee; import com.liyablieva.jaxws.service.EmployeeService; import com.liyablieva.jaxws.service.GetEmployeesResponseType; import org.springframework.beans.factory.annotation.Autowired; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import javax.xml.bind.annotation.XmlElement; import javax.xml.ws.Holder; import java.util.List; @WebService(serviceName = "EmployeeService") public class EmployeeServiceEndpoint { @Autowired private EmployeeService employeeService; @WebMethod public void putEmployee(@XmlElement(required = true) @WebParam(name = "department") String department, @XmlElement(required = true) @WebParam(name = "employee_name") String name, @XmlElement(required = true) @WebParam(name = "gender") String gender, @WebParam(name = "license") String license, @WebParam(name = "result", mode = WebParam.Mode.OUT) Holder<Integer> result, @WebParam(name = "description", mode = WebParam.Mode.OUT) Holder<String> description) { try { int status = employeeService.putEmployee(department, name, gender, license); if (status == 1) { description.value = "Employee put in db successfully."; } else { description.value = "Employee was not put in db!"; } result.value = status; } catch (IllegalArgumentException ex) { System.out.println("IllegalArgumentException in putEmployee: " + ex); result.value = -1; description.value = ex.getMessage(); } catch (Exception ex) { System.out.println("Exception in putEmployee: " + ex); result.value = -2; description.value = ex.getMessage(); } } @WebMethod public void getEmployees(@XmlElement(required = true) @WebParam(name = "department") String department, @WebParam(name = "result", mode = WebParam.Mode.OUT) Holder<Integer> result, @WebParam(name = "description", mode = WebParam.Mode.OUT) Holder<String> description, @WebParam(name = "employees_list", mode = WebParam.Mode.OUT) Holder<List<Employee>> employees) { try { GetEmployeesResponseType response = employeeService.getEmployees(department); result.value = response.getResult(); employees.value = response.getEmployees(); description.value = response.getDescription(); } catch (IllegalArgumentException ex) { System.out.println("IllegalArgumentException in getEmployee: " + ex); result.value = -1; description.value = ex.getMessage(); } catch (Exception ex) { System.out.println("Exception in getEmployee: " + ex); result.value = -2; description.value = ex.getMessage(); } } }