1. What is a Web Service?
  2. What are the advantages of Web Services?
  3. What are different types of Web Services?
  4. What is SOAP?
  5. What are advantages of SOAP Web Services?
  6. What are disadvantages of SOAP Web Services?
  7. What is WSDL?
  8. What are different components of WSDL?
  9. What is UDDI?
  10. What is difference between Top Down and Bottom Up approach in SOAP Web Services?
  11. What is REST Web Services?
  12. What are advantages of REST web services?
  13. What are disadvantages of REST web services?
  14. What is a Resource in Restful web services?
  15. What are different HTTP Methods supported in Restful Web Services?
  16. Compare SOAP and REST web services?
  17. What are different ways to test web services?
  18. Can we maintain user session in web services?
  19. What is difference between SOA and Web Services?
  20. What is the use of Accept and Content-Type Headers in HTTP Request?
  21. How would you choose between SOAP and REST web services?
  22. What is JAX-WS API?
  23. Name some frameworks in Java to implement SOAP web services?
  24. Name important annotations used in JAX-WS API?
  25. What is use of javax.xml.ws.Endpoint class?
  26. What is the difference between RPC Style and Document Style SOAP web Services?
  27. How to get WSDL file of a SOAP web service?
  28. What is sun-jaxws.xml file?
  29. What is JAX-RS API?
  30. Name some implementations of JAX-RS API?
  31. What is wsimport utility?
  32. Name important annotations used in JAX-RS API?
  33. What is the use of @XmlRootElement annotation?
  34. How to set different status code in HTTP response?

6. Develop Servlet Question-Answer Application using HttpServletRequest and HttpServletRequest interfaces.


Index.jsp(GUI)

%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html>
<html> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title>
</head> <body>
<form action="Question" method="GET">

<h4><u><center>Check Your Knowledge ........</center></u></h4> <h4>What JSP stand for </h4>
<input type="radio" name="q1" value="Java Server Pages"><b>Java Server Pages</b><br>
<input type="radio" name="q1" value="Java Server Programming"><b>Java Server Programming</b><br>
<input type="radio" name="q1" value="Java Service Pages"><b>Java Service Pages</b><br>
<input type="radio" name="q1" value="Java Service Programming"><b>Java Service Programming</b><br>
<h4>Which of the following languages can be used to write server side scripting in ASP.NET?</h4>
<input type="radio" name="q2" value="C#"><b>C#</b><br> <input type="radio" name="q2" value="VB"><b>VB</b><br> <input type="radio" name="q2" value="C++"><b>C++</b><br>
<input type="radio" name="q2" value="Both a and b"><b>Both a and b</b><br>




<h4>What command is used to remove files in Linux?</h4> <input type="radio" name="q3" value="dm"><b>dm</b><br> <input type="radio" name="q3" value="rm"><b>rm</b><br>
<input type="radio" name="q3" value="delete"><b>delete</b><br>

<input type="radio" name="q3" value="None of the above"><b>None of the above</b><br>
<input type="Submit" name="btnsubmit"> </form></body></html>



Question.java(Servlet File) 

import java.io.IOException; import java.io.PrintWriter;
import javax.servlet.ServletException; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;


public class Question extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8"); int correct=0;
int incorrect=0;

String a=request.getParameter("q1"); String b=request.getParameter("q2"); String c=request.getParameter("q3"); if(a.equals("Java Server Pages"))
{

correct++; }
else {
incorrect++; }


if(b.equals("Both a and b")) {
correct++; }
else {
incorrect++; }




if(c.equals("rm")) {
correct++; }
else {
incorrect++; }
PrintWriter out = response.getWriter(); try
{

/* 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 Question</title>"); out.println("</head>"); out.println("<body>");
out.println("<h2>Result Of the Test</h1><br>"); out.println("<h3>Correct Answer :::"+correct+"</h3>"); out.println("<h3>Incorrect Answer :::"+incorrect+"</h3>"); out.println("</body>");
out.println("</html>"); }
catch(NumberFormatException e) {
e.printStackTrace(); }



} }


12. Develop a JSP Application to Authenticate User Login as per the Registration Details. If Login Success then forward User to Index Page otherwise show Login failure Message.


Listing 1: Login Form

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Login Page</h1>
        <center>
            <h2>Signup Details</h2>
            <form action="LoginCheck.jsp" method="post">
            <br/>Username:<input type="text" name="username">
            <br/>Password:<input type="password" name="password">
            <br/><input type="submit" value="Submit">
            </form>
        </center>
    </body>
</html>




Listing 2: LoginCheck.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        String username=request.getParameter("username");
        String password=request.getParameter("password");
       
        if((username.equals("anurag") && password.equals("jain")))
            {
            session.setAttribute("username",username);
            response.sendRedirect("Home.jsp");
            }
        else
            response.sendRedirect("Error.jsp");
        %>
    </body>
</html>



Listing 3: Home.jsp

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="Error.jsp"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>       
        <br/><br/><br/><br/><br/>
        <center>
            <h2>
            <%
            String a=session.getAttribute("username").toString();
            out.println("Hello  "+a);
            %>
            </h2>
            <br/>
            <br/>
            <br/><br/><br/><br/><br/>
        <a href="logout.jsp">Logout</a>
        </center>

    </body>
</html>



Listing 4: Logout.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%

        session.removeAttribute("username");
        session.removeAttribute("password");
        session.invalidate();
        %>
        <h1>Logout was done successfully.</h1>
        
    </body>
</html>




Listing 5: Error.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Some Error has occured,Please try again later...</h1>
    </body>
</html>