Page 1 of 1

About Question enthuware.ocejws.v6.2.67 :

Posted: Thu Nov 26, 2015 2:54 pm
by anilboppuri
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?

Re: About Question enthuware.ocejws.v6.2.67 :

Posted: Sat Nov 28, 2015 2:46 am
by fjwalraven
Hi,

What part of the explanation did you not understand?

The attribute "name" in the WebService annotation refers to the wsdl:portType (the SEI of the WebService). When the @WebServiceRef is defined on a (field) property and refers to a generated SEI type (in this case the instance variable l is of type LogLog)
- the value element must be present (which it is in this option)
- the type element may be present (this element doesn't have to be present and it isn't)

Regards,
Frits