summaryrefslogtreecommitdiff
path: root/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src
diff options
context:
space:
mode:
Diffstat (limited to 'Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src')
-rw-r--r--Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/MANIFEST.MF2
-rw-r--r--Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.wsdl36
-rw-r--r--Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.xsd_1.xsd19
-rw-r--r--Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/java/me/dcariotti/netsix/NetSixServlet.java122
4 files changed, 179 insertions, 0 deletions
diff --git a/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/MANIFEST.MF b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/MANIFEST.MF
new file mode 100644
index 0000000..59499bc
--- /dev/null
+++ b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.wsdl b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.wsdl
new file mode 100644
index 0000000..eeb19c6
--- /dev/null
+++ b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.wsdl
@@ -0,0 +1,36 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is Metro/2.3.2-b608 (trunk-7979; 2015-01-21T12:50:19+0000) JAXWS-RI/2.2.11-b150120.1832 JAXWS-API/2.2.12 JAXB-RI/2.2.12-b141219.1637 JAXB-API/2.2.13-b141020.1521 svn-revision#unknown. --><!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is Metro/2.3.2-b608 (trunk-7979; 2015-01-21T12:50:19+0000) JAXWS-RI/2.2.11-b150120.1832 JAXWS-API/2.2.12 JAXB-RI/2.2.12-b141219.1637 JAXB-API/2.2.13-b141020.1521 svn-revision#unknown. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://wsserv.dcariotti.me/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://wsserv.dcariotti.me/" name="WsServ">
+<types>
+<xsd:schema>
+<xsd:import namespace="http://wsserv.dcariotti.me/" schemaLocation="http://localhost:8080/NetSixServer/WsServ?xsd=1"/>
+</xsd:schema>
+</types>
+<message name="richiedi">
+<part name="parameters" element="tns:richiedi"/>
+</message>
+<message name="richiediResponse">
+<part name="parameters" element="tns:richiediResponse"/>
+</message>
+<portType name="WsServ">
+<operation name="richiedi">
+<input wsam:Action="http://wsserv.dcariotti.me/WsServ/richiediRequest" message="tns:richiedi"/>
+<output wsam:Action="http://wsserv.dcariotti.me/WsServ/richiediResponse" message="tns:richiediResponse"/>
+</operation>
+</portType>
+<binding name="WsServPortBinding" type="tns:WsServ">
+<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+<operation name="richiedi">
+<soap:operation soapAction=""/>
+<input>
+<soap:body use="literal"/>
+</input>
+<output>
+<soap:body use="literal"/>
+</output>
+</operation>
+</binding>
+<service name="WsServ">
+<port name="WsServPort" binding="tns:WsServPortBinding">
+<soap:address location="http://localhost:8080/NetSixServer/WsServ"/>
+</port>
+</service>
+</definitions> \ No newline at end of file
diff --git a/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.xsd_1.xsd b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.xsd_1.xsd
new file mode 100644
index 0000000..ea0cc30
--- /dev/null
+++ b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/conf/xml-resources/web-service-references/WsServ/wsdl/localhost_8080/NetSixServer/WsServ.xsd_1.xsd
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is Metro/2.3.2-b608 (trunk-7979; 2015-01-21T12:50:19+0000) JAXWS-RI/2.2.11-b150120.1832 JAXWS-API/2.2.12 JAXB-RI/2.2.12-b141219.1637 JAXB-API/2.2.13-b141020.1521 svn-revision#unknown. --><xs:schema xmlns:tns="http://wsserv.dcariotti.me/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://wsserv.dcariotti.me/">
+
+<xs:element name="richiedi" type="tns:richiedi"/>
+
+<xs:element name="richiediResponse" type="tns:richiediResponse"/>
+
+<xs:complexType name="richiedi">
+<xs:sequence>
+<xs:element name="name" type="xs:string" minOccurs="0"/>
+<xs:element name="episode" type="xs:int"/>
+</xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="richiediResponse">
+<xs:sequence>
+<xs:element name="return" type="xs:boolean"/>
+</xs:sequence>
+</xs:complexType>
+</xs:schema> \ No newline at end of file
diff --git a/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/java/me/dcariotti/netsix/NetSixServlet.java b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/java/me/dcariotti/netsix/NetSixServlet.java
new file mode 100644
index 0000000..6387ccf
--- /dev/null
+++ b/Year_3/TSDWL/WSDL/NetSix/NetSixServerClient/src/java/me/dcariotti/netsix/NetSixServlet.java
@@ -0,0 +1,122 @@
+/*
+ * 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.netsix;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author dcariotti
+ */
+@WebServlet(name = "NetSixServlet", urlPatterns = {"/NetSixServlet"})
+public class NetSixServlet extends HttpServlet {
+
+ /**
+ * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
+ * methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("text/html;charset=UTF-8");
+ try (PrintWriter out = response.getWriter()) {
+ /* TODO output your page here. You may use following sample code. */
+ out.println("<!DOCTYPE html>");
+ out.println("<html>");
+ out.println("<head>");
+ out.println("<title>Servlet NetSixServlet</title>");
+ out.println("</head>");
+ out.println("<body>");
+ out.println("<h1>Servlet NetSixServlet at " + request.getContextPath() + "</h1>");
+ out.println("</body>");
+ out.println("</html>");
+ }
+ }
+
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+ /**
+ * Handles the HTTP <code>GET</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ RequestDispatcher view = request.getRequestDispatcher("/search.html");
+
+ view.forward(request, response);
+ }
+
+ /**
+ * Handles the HTTP <code>POST</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("text/html");
+ String serie_name = request.getParameter("name");
+ String serie_episode = request.getParameter("episode");
+
+ if (serie_name != "" && serie_episode != "") {
+ boolean result = this.richiedi(serie_name, new Integer(serie_episode));
+ PrintWriter out = response.getWriter();
+
+ out.print("Episode number `");
+ out.print(serie_episode);
+ out.print("` of `");
+ out.print(serie_name);
+ out.print("` is ");
+
+ if (result) {
+ out.print("present");
+ } else {
+ out.print(" NOT present");
+ }
+
+ return;
+ }
+
+ try (PrintWriter out = response.getWriter()) {
+ out.println("You must set both input names");
+ }
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ *
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }// </editor-fold>
+
+ private static boolean richiedi(java.lang.String name, int episode) {
+ me.dcariotti.netsix.WsServ_Service service = new me.dcariotti.netsix.WsServ_Service();
+ me.dcariotti.netsix.WsServ port = service.getWsServPort();
+ return port.richiedi(name, episode);
+ }
+
+}