@Override @WebMethod(operationName = "getTournamentsByLocationAndDate") public Tournaments getAllTournamentsByLocationAndDate( @WebParam(name = "location") String location, @WebParam(name = "dateFrom") String dateFrom, @WebParam(name = "dateTo") String dateTo) throws InvalidInputException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date tournamentStartDate; Date tournamentEndDate; try { tournamentStartDate = format.parse(dateFrom); } catch (ParseException e) { throw new InvalidInputException(e.getMessage(), "Invalid date format"); } try { tournamentEndDate = format.parse(dateTo); } catch (ParseException e) { throw new InvalidInputException(e.getMessage(), "Invalid date format"); } List<Tournament> tournamentsFromDB = tournamentService.getAllTournamentsByLocationAndDate( location, tournamentStartDate, tournamentEndDate); Tournaments tournaments = new Tournaments(); tournaments.setTournaments(tournamentsFromDB); return tournaments; }