From 6f0592cb2b753fb47297464a3fa1a312620da3ba Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 18 Jan 2022 20:31:22 +0100 Subject: Add WSDL exercise --- .../src/java/me/dcariotti/wsserv/WsServ.java | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Year_3/TSDWL/WSDL/NetSix/NetSixServer/src/java/me/dcariotti/wsserv/WsServ.java (limited to 'Year_3/TSDWL/WSDL/NetSix/NetSixServer/src/java/me') diff --git a/Year_3/TSDWL/WSDL/NetSix/NetSixServer/src/java/me/dcariotti/wsserv/WsServ.java b/Year_3/TSDWL/WSDL/NetSix/NetSixServer/src/java/me/dcariotti/wsserv/WsServ.java new file mode 100644 index 0000000..8ff11d1 --- /dev/null +++ b/Year_3/TSDWL/WSDL/NetSix/NetSixServer/src/java/me/dcariotti/wsserv/WsServ.java @@ -0,0 +1,46 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package me.dcariotti.wsserv; + +import java.util.HashMap; +import javax.jws.WebService; +import javax.jws.WebMethod; +import javax.jws.WebParam; + +/** + * + * @author dcariotti + */ +@WebService(serviceName = "WsServ") +public class WsServ { + + private HashMap series; + + public WsServ() { + this.series = new HashMap(); + this.series.put("The Witcher", new int[] {1, 2, 3, 4, 5, 6}); + this.series.put("Rick & Morty", new int[] {1, 2, 3, 4, 5, 6, 7, 8}); + this.series.put("After Life", new int[] {1, 4, 5, 6, 9}); + this.series.put("Lovesick", new int[] {1, 2, 3, 4, 5, 6, 7}); + this.series.put("Chuck", new int[] {1, 2, 3, 4, 5, 6}); + this.series.put("Halt and catch fire", new int[] {1, 2, 3}); + } + + @WebMethod(operationName = "richiedi") + public boolean richiedi(@WebParam(name = "name") final String name, @WebParam(name = "episode") final int episode) { + if (this.series.containsKey(name)) { + int[] episodes = this.series.get(name); + + for (int number : episodes) { + if (number == episode) { + return true; + } + } + } + + return false; + } +} -- cgit v1.2.3-18-g5258