About Question enthuware.ocejws.v6.2.67 :

Moderators: Site Manager, fjwalraven

Post Reply
anilboppuri
Posts: 1
Joined: Thu Nov 26, 2015 2:32 pm
Contact:

About Question enthuware.ocejws.v6.2.67 :

Post 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?

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

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

Post 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

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests