About Question enthuware.ocejws.v6.2.67 :
Posted: Thu Nov 26, 2015 2:54 pm
What should be inserted in line // 1 if we want to refer to this Web Service in a Servlet based client (i.e. LogServlet).
@WebService(serviceName="LogWebService", name="LogLog") public class LogServiceImpl { @WebMethod public void log(String msg) { System.out.println(msg); } } @WebServlet(urlPatterns="/log") public class LogServlet extends HttpServlet { // 1 LogLog l; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.write("<html><head></head><body>"); String logString = request.getParameter("log"); l.log(logString); writer.write("<h1>" + logString); writer.write("</h1>"); writer.write("</body></html>"); } }
@WebServiceRef(LogWebService.class), My question is why this option is correct?
@WebService(serviceName="LogWebService", name="LogLog") public class LogServiceImpl { @WebMethod public void log(String msg) { System.out.println(msg); } } @WebServlet(urlPatterns="/log") public class LogServlet extends HttpServlet { // 1 LogLog l; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.write("<html><head></head><body>"); String logString = request.getParameter("log"); l.log(logString); writer.write("<h1>" + logString); writer.write("</h1>"); writer.write("</body></html>"); } }
@WebServiceRef(LogWebService.class), My question is why this option is correct?