{"id":364,"date":"2018-07-27T11:05:06","date_gmt":"2018-07-27T11:05:06","guid":{"rendered":"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=364"},"modified":"2018-08-02T08:54:48","modified_gmt":"2018-08-02T08:54:48","slug":"web-services-ii","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/chapter\/web-services-ii\/","title":{"rendered":"WEB SERVICES -II"},"content":{"raw":"<strong>Learning Objectives<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the previous module, we have studied about the basics of webservice, components of web service, architecture of web services and applications of web services. In this module, we are going to learn how to create a new web service and how to deploy it using NETBEANS IDE.Also, consumption of web services in different modes is going to be learnt.<\/p>\r\n\r\n<ol>\r\n \t<li><strong>WEB SERVICE CREATION<\/strong><\/li>\r\n<\/ol>\r\n<p style=\"text-align: justify\">\u00a0 \u00a0 Here, we are going to see how to create a web service in Java using NetBeans IDE using GlassFish 4.0 specifications.<\/p>\r\n&nbsp;\r\n\r\n<strong>1.1 Creating a Web Service in Java using NetBeans IDE<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe step-by-step instructions to create and deploy a web service in Java using NetBeans\r\n\r\nIDE and GlassFish 4.0 are as follows:\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Prerequistites for creating the web service is the requirement of NetBeans 8.0 IDE which can be downloaded from https:\/\/netbeans.org\/downloads\/ - Link.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Step 1:<\/strong>To create a Java based web service, open NetBeans IDE and click on New Project and choose Java Web -&gt; Web Application as shown in Figure 1. Enter the Project Name as CalculationWS, use the default settings and then click on \u201cFinish\u201d. Now the server required for the web service need to be selected and the server chosen here Glass Fish server with Java EE 7 Web version as shown in Figure 2.Now a new Project has been created using these settings.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-365 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231.png\" alt=\"\" width=\"670\" height=\"267\" \/><\/p>\r\n<p style=\"text-align: center\">Figure 1. Creation of a Web Application<\/p>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-366 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232.png\" alt=\"\" width=\"582\" height=\"257\" \/><\/p>\r\n&nbsp;\r\n\r\n<strong>Step 2: Create a Web Service<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Once the project has been created, now we are supposed to create a web service. For that, go to the Project Tree Structure displayed on the left side of the window. Right click on the project and select \u201cNew\u201d and then choose \u201cWeb Service\u201d as shown in Figure 3.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-367 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233.png\" alt=\"\" width=\"474\" height=\"338\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 3. Creation of Web service<\/strong><\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Specify web service name as \u201cCalWS\u201d and package name as \u201cCalculationWS\u201d as indicated in Figure 4. Click on \u201cFinish\u201d to create a new web service.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-368 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234.png\" alt=\"\" width=\"571\" height=\"371\" \/><\/p>\r\n\r\n<div>\r\n<p style=\"text-align: center\"><strong>Figure 4. Naming of new Web Service<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Once the web service creation is over, the next step is to create a method over it which can act on the web service created. Once you open the CalWS in the editor, you will get a skeleton code. Inside the skeleton code, you can enter the code as per your requirement. According to this project, in CalWS.java file, the original hello() function has been replaced with the following code:<\/p>\r\n&nbsp;\r\n\r\n@WebMethod(operationName = \"Add\")\r\n\r\npublic String Add(@WebParam(name = \"value1\") String value1,@WebParam(name = \"value2\") String value2 ) {\r\n\r\nfloat value=Float.valueOf(value1)+Float.valueOf(value2); return (Float.toString(value));\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Here, @Web method corresponds to the method of web service, @WebParam corrersponds to the parameters passed to the method with two string arguments. In this code, value of two floating point numbers has been added and a string equivalent of that value has been returned. Now the web service method has been created.<\/span><\/p>\r\n\r\n<\/div>\r\n<p style=\"text-align: justify\"><strong>\u00a0 Step 3: <\/strong>Deploy and Test Web Service by choosing Projects-&gt;CalculationWS-&gt;Deploy. Right click on the project and select \u201cDeploy\u201d as shown in Figure 5.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-369 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235.png\" alt=\"\" width=\"357\" height=\"322\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">This is to deploy all the web services in this project. Once the web service has been deployed, you will get a message that, \u201cweb service deployed successfully\u201d. To test the web service, right click on the service and select \u201cTest Web Service\u201d. Again, Right click on the project and select \u201cclean and build\u201d, a war file will be automatically generated under the \u201cdist\u201d directory as shown in Figure 6.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-370 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236.png\" alt=\"\" width=\"398\" height=\"285\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-371 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237.png\" alt=\"\" width=\"632\" height=\"251\" \/><\/p>\r\n<p style=\"text-align: justify\">Once tested, tester page will be displayed as shown in Figure 7, type two numbers in the tester page and deploy it using glassfish server. The sum of the two numbers will be displayed as shown in the figure 8.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-372 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238.png\" alt=\"\" width=\"450\" height=\"292\" \/><\/p>\r\n\r\n<div>\r\n\r\n<strong>\u00a0 2.\u00a0<\/strong><strong>CONSUMING THE WEB SERVICE<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">After the creation of web service, some client applications need to get developed inorder to consume the web services. The web service can be consumed by creating a client application using anyone of the following ways:<\/p>\r\n\r\n<ul>\r\n \t<li>Java Class in Java SE Application<\/li>\r\n \t<li>Servlet in Web Application<\/li>\r\n \t<li>JSP Page in Web Application<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>2.1 Java Class in Java SE Application<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\">A Java class in a Java SE application can be created to consume a web service by following the given steps:<\/li>\r\n \t<li style=\"text-align: justify\">\u00a0Choose File &gt; New Project (Ctrl-Shift-N on Linux and Windows).<\/li>\r\n \t<li style=\"text-align: justify\">Select Java Application from the Java category. Name the project as \u201cCalculatorWS_Client_Application\u201d. Create Main Class selected and accept all other default settings.<\/li>\r\n \t<li style=\"text-align: justify\">Click Finish to create the client application.<\/li>\r\n \t<li style=\"text-align: justify\">Once\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 client\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 application\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 has\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 been\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 created,\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Right-click<\/li>\r\n \t<li style=\"text-align: justify\">the CalculatorWS_Client_Application node and choose New &gt; Web Service Client. The New Web Service Client wizard opens.<\/li>\r\n \t<li style=\"text-align: justify\"><span style=\"font-size: 1em\">Select Project as the WSDL source. Click Browse. Browse to the CalWS web service from the CalculationWS in the CalculatorWSApplication project as shown in the figure 9.<\/span><\/li>\r\n<\/ul>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-373 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239.png\" alt=\"\" width=\"474\" height=\"314\" \/><\/p>\r\n\r\n<ul>\r\n \t<li style=\"text-align: justify\">When you have selected the web service, click OK. The following dialog box shown in Figure 10 gets opened, where you don\u2019t select a package name and leave that field empty. Leave the other settings at default and click Finish.<\/li>\r\n<\/ul>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-374 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240.png\" alt=\"\" width=\"627\" height=\"477\" \/><\/p>\r\n\r\n<ul>\r\n \t<li style=\"text-align: justify\">\u00d8 The projects window displays the new web service client, with a link node under web service references for the addition method that you have created using the web service . This is shown in Figure 11.<\/li>\r\n<\/ul>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-375 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241.png\" alt=\"\" width=\"355\" height=\"371\" \/><\/p>\r\n\r\n<ul>\r\n \t<li>Double-click the main class so that it opens in the Source Editor. Drag the add node below the main() method as shown in Figure 12.<\/li>\r\n<\/ul>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-376 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242.png\" alt=\"\" width=\"629\" height=\"389\" \/><\/p>\r\n\r\n<div>\r\n<p style=\"text-align: justify\">Alternatively, instead of dragging the add node, you can right-click in the editor and then choose Insert Code &gt; Call Web Service Operation.<\/p>\r\n&nbsp;\r\n\r\npublic static void main (String args[])\r\n\r\n{\r\n\r\nprivate static string addition(float i, float j)\r\n\r\n{\r\n\r\norg.me.Calculation.CalWS_service = new org.me.Calculation.CalWS_service(); Org.me.Calculation.CalWSport = service.getCalWSport(); return port.add(i,j);\r\n\r\n}\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nIn the main() method body, replace the TODO comment with code that initializes values for i and j, calls add(), and prints the result.\r\n\r\n&nbsp;\r\n\r\npublic static void main(String[] args)\r\n\r\n{\r\n\r\nint i = 3;\r\n\r\nint j = 4;\r\n\r\nresult = add(i, j);\r\n\r\nSystem.out.println(\"Result = \" + result);\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nThe Output window now shows the sum:\r\n\r\n&nbsp;\r\n\r\nCompile: run: Result = 7\r\n\r\n&nbsp;\r\n\r\nBUILD SUCCESSFUL (total time: 1 second)\r\n\r\n&nbsp;\r\n\r\n<strong>2.2 JSP Page in Web Application<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe web service can be consumed by creating a JSP page which is done by following the given steps:\r\n<ul>\r\n \t<li style=\"text-align: justify\">Choose File -&gt; New Project (Ctrl+Shift+N on Linux and Windows).<\/li>\r\n \t<li style=\"text-align: justify\">Select\u00a0\u00a0 Web\u00a0\u00a0 Application\u00a0\u00a0 from\u00a0\u00a0 the\u00a0\u00a0 Java\u00a0\u00a0 Web\u00a0\u00a0 category.\u00a0\u00a0 Name\u00a0\u00a0 the\u00a0\u00a0 project \u201cCalculatorWSJSPClient\u201d. Clicknext and then click Finish.<\/li>\r\n \t<li style=\"text-align: justify\">Expand the web page node under the project node and delete index.html.<\/li>\r\n \t<li style=\"text-align: justify\">Right click on the web pages node and choose new-&gt;JSP in the popup menu.<\/li>\r\n \t<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">If JSP is not available in the popup menu. Choose new-&gt;Other and select JSP in the web category of the new file wizard.<\/span><\/li>\r\n \t<li style=\"text-align: justify\">Type index for the name of the JSP file in the new file wizard and click finish.<\/li>\r\n \t<li style=\"text-align: justify\">Right click the CAlculatorWSJSPClient node and choose new -&gt; web service client.<\/li>\r\n \t<li style=\"text-align: justify\">Select project as the WSDL source. Click browse and browse the CalWS web service in the CalculatorWSApplication project.<\/li>\r\n \t<li style=\"text-align: justify\">After selecting the web service, Click OK.<\/li>\r\n \t<li style=\"text-align: justify\">In the web service reference node, expand the node represents the web service.<\/li>\r\n \t<li style=\"text-align: justify\">The add operation that has to be invoked by the client is now exposed.<\/li>\r\n \t<li style=\"text-align: justify\">Drag the add operation to the client\u2019s index.jsp page and drop it below the H1 tags.<\/li>\r\n \t<li style=\"text-align: justify\">The code for invoking the service\u2019s operation is now generated in the index.jsp as shown below:<\/li>\r\n<\/ul>\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0try { org.me.calculation.CalWS_Service service = new\r\n\r\norg.me.calculation.CalWS_Service();\r\n\r\norg.me.calculation.CalWS port = service.getCalWSPort();\r\n\r\nint i=0;\r\n\r\nint j=0;\r\n\r\nint result= port.add(i, j);\r\n\r\nout.println(\u201cResult=\u201d +result);\r\n\r\n}\r\n\r\ncatch{Exception ex}\r\n\r\n{\/\/TODO handle custom exceptions here}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The values for i and j are changed from zero to other integer, such as 3 and 4.Replace the comment section of the TODO in the exception handling catch block with<\/p>\r\n&nbsp;\r\n\r\n\u201cout.println (\u201cexception\u201d +ex);\u201d\r\n\r\n&nbsp;\r\n\r\nWhen the above code is executed, the output will be displayed as follows in figure 13.\r\n\r\n<\/div>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-377 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-243.png\" alt=\"\" width=\"256\" height=\"170\" \/><\/p>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In this module, we have learnt about the creation and deployment of web services. Following that, we have learnt about the various ways in which a web service can be consumed by different types of applications such as Java and JSP.<\/p>\r\n\r\n<\/div>\r\n<strong>Web Links<\/strong>\r\n<ul>\r\n \t<li>https:\/\/www.tutorialspoint.com\/webservices\/what_are_web_services.htm<\/li>\r\n \t<li>http:\/\/www.java4s.com\/web-services\/<\/li>\r\n \t<li>http:\/\/javapapers.com\/web-service\/restful-services-http-basic-authentication\/<\/li>\r\n \t<li>https:\/\/www.cl.cam.ac.uk\/~ib249\/teaching\/Lecture1.handout.pdf<\/li>\r\n \t<li>https:\/\/www.w3schools.com\/xml\/xml_services.asp<\/li>\r\n \t<li>https:\/\/www.javatpoint.com\/web-services-tutorial<\/li>\r\n \t<li>https:\/\/www.cs.colorado.edu\/~kena\/classes\/7818\/f08\/lectures\/lecture_4_netbeans_presenta.pdf<\/li>\r\n \t<li>http:\/\/vhost3.cs.rit.edu\/project_web_page\/webservices.html<\/li>\r\n \t<li>http:\/\/cs.ulb.ac.be\/public\/teaching\/infoh511<\/li>\r\n \t<li>https:\/\/www.fas.harvard.edu\/~cscie259\/distribution\/lectures\/1\/lecture1.pdf<\/li>\r\n \t<li>http:\/\/www.java2blog.com\/2013\/03\/web-service-tutorial.html<\/li>\r\n \t<li><a href=\"http:\/\/www2.imm.dtu.dk\/courses\/02267\/slides\/weekp08.pdf\">http:\/\/www2.imm.dtu.dk\/courses\/02267\/slides\/weekp08.pdf<\/a><\/li>\r\n \t<li>David Chappell and Tyler Jewell, \u201cJava Web Services\u201d, First Edition, O'Reilly, 2002<\/li>\r\n \t<li>\u00a0Paul J. Deitel, Harvey Deitel, \u201cJava How to Program\u201d, Ninth Edition, Pearson,2012.<\/li>\r\n<\/ul>","rendered":"<p><strong>Learning Objectives<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the previous module, we have studied about the basics of webservice, components of web service, architecture of web services and applications of web services. In this module, we are going to learn how to create a new web service and how to deploy it using NETBEANS IDE.Also, consumption of web services in different modes is going to be learnt.<\/p>\n<ol>\n<li><strong>WEB SERVICE CREATION<\/strong><\/li>\n<\/ol>\n<p style=\"text-align: justify\">\u00a0 \u00a0 Here, we are going to see how to create a web service in Java using NetBeans IDE using GlassFish 4.0 specifications.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1.1 Creating a Web Service in Java using NetBeans IDE<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The step-by-step instructions to create and deploy a web service in Java using NetBeans<\/p>\n<p>IDE and GlassFish 4.0 are as follows:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Prerequistites for creating the web service is the requirement of NetBeans 8.0 IDE which can be downloaded from https:\/\/netbeans.org\/downloads\/ &#8211; Link.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Step 1:<\/strong>To create a Java based web service, open NetBeans IDE and click on New Project and choose Java Web -&gt; Web Application as shown in Figure 1. Enter the Project Name as CalculationWS, use the default settings and then click on \u201cFinish\u201d. Now the server required for the web service need to be selected and the server chosen here Glass Fish server with Java EE 7 Web version as shown in Figure 2.Now a new Project has been created using these settings.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-365 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231.png\" alt=\"\" width=\"670\" height=\"267\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231.png 670w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231-300x120.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231-65x26.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231-225x90.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-231-350x139.png 350w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/p>\n<p style=\"text-align: center\">Figure 1. Creation of a Web Application<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-366 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232.png\" alt=\"\" width=\"582\" height=\"257\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232.png 582w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232-300x132.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232-225x99.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-232-350x155.png 350w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Step 2: Create a Web Service<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Once the project has been created, now we are supposed to create a web service. For that, go to the Project Tree Structure displayed on the left side of the window. Right click on the project and select \u201cNew\u201d and then choose \u201cWeb Service\u201d as shown in Figure 3.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-367 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233.png\" alt=\"\" width=\"474\" height=\"338\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233.png 474w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233-300x214.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233-65x46.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233-225x160.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-233-350x250.png 350w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 3. Creation of Web service<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Specify web service name as \u201cCalWS\u201d and package name as \u201cCalculationWS\u201d as indicated in Figure 4. Click on \u201cFinish\u201d to create a new web service.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-368 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234.png\" alt=\"\" width=\"571\" height=\"371\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234.png 571w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234-300x195.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234-65x42.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234-225x146.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-234-350x227.png 350w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><\/p>\n<div>\n<p style=\"text-align: center\"><strong>Figure 4. Naming of new Web Service<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Once the web service creation is over, the next step is to create a method over it which can act on the web service created. Once you open the CalWS in the editor, you will get a skeleton code. Inside the skeleton code, you can enter the code as per your requirement. According to this project, in CalWS.java file, the original hello() function has been replaced with the following code:<\/p>\n<p>&nbsp;<\/p>\n<p>@WebMethod(operationName = &#8220;Add&#8221;)<\/p>\n<p>public String Add(@WebParam(name = &#8220;value1&#8221;) String value1,@WebParam(name = &#8220;value2&#8221;) String value2 ) {<\/p>\n<p>float value=Float.valueOf(value1)+Float.valueOf(value2); return (Float.toString(value));<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Here, @Web method corresponds to the method of web service, @WebParam corrersponds to the parameters passed to the method with two string arguments. In this code, value of two floating point numbers has been added and a string equivalent of that value has been returned. Now the web service method has been created.<\/span><\/p>\n<\/div>\n<p style=\"text-align: justify\"><strong>\u00a0 Step 3: <\/strong>Deploy and Test Web Service by choosing Projects-&gt;CalculationWS-&gt;Deploy. Right click on the project and select \u201cDeploy\u201d as shown in Figure 5.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-369 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235.png\" alt=\"\" width=\"357\" height=\"322\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235.png 357w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235-300x271.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235-65x59.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235-225x203.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-235-350x316.png 350w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">This is to deploy all the web services in this project. Once the web service has been deployed, you will get a message that, \u201cweb service deployed successfully\u201d. To test the web service, right click on the service and select \u201cTest Web Service\u201d. Again, Right click on the project and select \u201cclean and build\u201d, a war file will be automatically generated under the \u201cdist\u201d directory as shown in Figure 6.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-370 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236.png\" alt=\"\" width=\"398\" height=\"285\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236.png 398w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236-300x215.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236-65x47.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236-225x161.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-236-350x251.png 350w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-371 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237.png\" alt=\"\" width=\"632\" height=\"251\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237.png 632w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237-300x119.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237-65x26.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237-225x89.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-237-350x139.png 350w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/p>\n<p style=\"text-align: justify\">Once tested, tester page will be displayed as shown in Figure 7, type two numbers in the tester page and deploy it using glassfish server. The sum of the two numbers will be displayed as shown in the figure 8.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-372 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238.png\" alt=\"\" width=\"450\" height=\"292\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238.png 450w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238-300x195.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238-65x42.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238-225x146.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-238-350x227.png 350w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/p>\n<div>\n<p><strong>\u00a0 2.\u00a0<\/strong><strong>CONSUMING THE WEB SERVICE<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">After the creation of web service, some client applications need to get developed inorder to consume the web services. The web service can be consumed by creating a client application using anyone of the following ways:<\/p>\n<ul>\n<li>Java Class in Java SE Application<\/li>\n<li>Servlet in Web Application<\/li>\n<li>JSP Page in Web Application<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>2.1 Java Class in Java SE Application<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\">A Java class in a Java SE application can be created to consume a web service by following the given steps:<\/li>\n<li style=\"text-align: justify\">\u00a0Choose File &gt; New Project (Ctrl-Shift-N on Linux and Windows).<\/li>\n<li style=\"text-align: justify\">Select Java Application from the Java category. Name the project as \u201cCalculatorWS_Client_Application\u201d. Create Main Class selected and accept all other default settings.<\/li>\n<li style=\"text-align: justify\">Click Finish to create the client application.<\/li>\n<li style=\"text-align: justify\">Once\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 client\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 application\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 has\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 been\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 created,\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Right-click<\/li>\n<li style=\"text-align: justify\">the CalculatorWS_Client_Application node and choose New &gt; Web Service Client. The New Web Service Client wizard opens.<\/li>\n<li style=\"text-align: justify\"><span style=\"font-size: 1em\">Select Project as the WSDL source. Click Browse. Browse to the CalWS web service from the CalculationWS in the CalculatorWSApplication project as shown in the figure 9.<\/span><\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-373 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239.png\" alt=\"\" width=\"474\" height=\"314\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239.png 474w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239-300x199.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239-65x43.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239-225x149.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-239-350x232.png 350w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<ul>\n<li style=\"text-align: justify\">When you have selected the web service, click OK. The following dialog box shown in Figure 10 gets opened, where you don\u2019t select a package name and leave that field empty. Leave the other settings at default and click Finish.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-374 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240.png\" alt=\"\" width=\"627\" height=\"477\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240.png 627w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240-300x228.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240-65x49.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240-225x171.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-240-350x266.png 350w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<ul>\n<li style=\"text-align: justify\">\u00d8 The projects window displays the new web service client, with a link node under web service references for the addition method that you have created using the web service . This is shown in Figure 11.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-375 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241.png\" alt=\"\" width=\"355\" height=\"371\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241.png 355w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241-287x300.png 287w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241-65x68.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241-225x235.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-241-350x366.png 350w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/p>\n<ul>\n<li>Double-click the main class so that it opens in the Source Editor. Drag the add node below the main() method as shown in Figure 12.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-376 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242.png\" alt=\"\" width=\"629\" height=\"389\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242.png 629w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242-300x186.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242-65x40.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242-225x139.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-242-350x216.png 350w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/p>\n<div>\n<p style=\"text-align: justify\">Alternatively, instead of dragging the add node, you can right-click in the editor and then choose Insert Code &gt; Call Web Service Operation.<\/p>\n<p>&nbsp;<\/p>\n<p>public static void main (String args[])<\/p>\n<p>{<\/p>\n<p>private static string addition(float i, float j)<\/p>\n<p>{<\/p>\n<p>org.me.Calculation.CalWS_service = new org.me.Calculation.CalWS_service(); Org.me.Calculation.CalWSport = service.getCalWSport(); return port.add(i,j);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>In the main() method body, replace the TODO comment with code that initializes values for i and j, calls add(), and prints the result.<\/p>\n<p>&nbsp;<\/p>\n<p>public static void main(String[] args)<\/p>\n<p>{<\/p>\n<p>int i = 3;<\/p>\n<p>int j = 4;<\/p>\n<p>result = add(i, j);<\/p>\n<p>System.out.println(&#8220;Result = &#8221; + result);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>The Output window now shows the sum:<\/p>\n<p>&nbsp;<\/p>\n<p>Compile: run: Result = 7<\/p>\n<p>&nbsp;<\/p>\n<p>BUILD SUCCESSFUL (total time: 1 second)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2.2 JSP Page in Web Application<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The web service can be consumed by creating a JSP page which is done by following the given steps:<\/p>\n<ul>\n<li style=\"text-align: justify\">Choose File -&gt; New Project (Ctrl+Shift+N on Linux and Windows).<\/li>\n<li style=\"text-align: justify\">Select\u00a0\u00a0 Web\u00a0\u00a0 Application\u00a0\u00a0 from\u00a0\u00a0 the\u00a0\u00a0 Java\u00a0\u00a0 Web\u00a0\u00a0 category.\u00a0\u00a0 Name\u00a0\u00a0 the\u00a0\u00a0 project \u201cCalculatorWSJSPClient\u201d. Clicknext and then click Finish.<\/li>\n<li style=\"text-align: justify\">Expand the web page node under the project node and delete index.html.<\/li>\n<li style=\"text-align: justify\">Right click on the web pages node and choose new-&gt;JSP in the popup menu.<\/li>\n<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">If JSP is not available in the popup menu. Choose new-&gt;Other and select JSP in the web category of the new file wizard.<\/span><\/li>\n<li style=\"text-align: justify\">Type index for the name of the JSP file in the new file wizard and click finish.<\/li>\n<li style=\"text-align: justify\">Right click the CAlculatorWSJSPClient node and choose new -&gt; web service client.<\/li>\n<li style=\"text-align: justify\">Select project as the WSDL source. Click browse and browse the CalWS web service in the CalculatorWSApplication project.<\/li>\n<li style=\"text-align: justify\">After selecting the web service, Click OK.<\/li>\n<li style=\"text-align: justify\">In the web service reference node, expand the node represents the web service.<\/li>\n<li style=\"text-align: justify\">The add operation that has to be invoked by the client is now exposed.<\/li>\n<li style=\"text-align: justify\">Drag the add operation to the client\u2019s index.jsp page and drop it below the H1 tags.<\/li>\n<li style=\"text-align: justify\">The code for invoking the service\u2019s operation is now generated in the index.jsp as shown below:<\/li>\n<\/ul>\n<\/div>\n<div>\n<p>\u00a0 \u00a0try { org.me.calculation.CalWS_Service service = new<\/p>\n<p>org.me.calculation.CalWS_Service();<\/p>\n<p>org.me.calculation.CalWS port = service.getCalWSPort();<\/p>\n<p>int i=0;<\/p>\n<p>int j=0;<\/p>\n<p>int result= port.add(i, j);<\/p>\n<p>out.println(\u201cResult=\u201d +result);<\/p>\n<p>}<\/p>\n<p>catch{Exception ex}<\/p>\n<p>{\/\/TODO handle custom exceptions here}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The values for i and j are changed from zero to other integer, such as 3 and 4.Replace the comment section of the TODO in the exception handling catch block with<\/p>\n<p>&nbsp;<\/p>\n<p>\u201cout.println (\u201cexception\u201d +ex);\u201d<\/p>\n<p>&nbsp;<\/p>\n<p>When the above code is executed, the output will be displayed as follows in figure 13.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-377 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-243.png\" alt=\"\" width=\"256\" height=\"170\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-243.png 256w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-243-65x43.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-243-225x149.png 225w\" sizes=\"auto, (max-width: 256px) 100vw, 256px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In this module, we have learnt about the creation and deployment of web services. Following that, we have learnt about the various ways in which a web service can be consumed by different types of applications such as Java and JSP.<\/p>\n<\/div>\n<p><strong>Web Links<\/strong><\/p>\n<ul>\n<li>https:\/\/www.tutorialspoint.com\/webservices\/what_are_web_services.htm<\/li>\n<li>http:\/\/www.java4s.com\/web-services\/<\/li>\n<li>http:\/\/javapapers.com\/web-service\/restful-services-http-basic-authentication\/<\/li>\n<li>https:\/\/www.cl.cam.ac.uk\/~ib249\/teaching\/Lecture1.handout.pdf<\/li>\n<li>https:\/\/www.w3schools.com\/xml\/xml_services.asp<\/li>\n<li>https:\/\/www.javatpoint.com\/web-services-tutorial<\/li>\n<li>https:\/\/www.cs.colorado.edu\/~kena\/classes\/7818\/f08\/lectures\/lecture_4_netbeans_presenta.pdf<\/li>\n<li>http:\/\/vhost3.cs.rit.edu\/project_web_page\/webservices.html<\/li>\n<li>http:\/\/cs.ulb.ac.be\/public\/teaching\/infoh511<\/li>\n<li>https:\/\/www.fas.harvard.edu\/~cscie259\/distribution\/lectures\/1\/lecture1.pdf<\/li>\n<li>http:\/\/www.java2blog.com\/2013\/03\/web-service-tutorial.html<\/li>\n<li><a href=\"http:\/\/www2.imm.dtu.dk\/courses\/02267\/slides\/weekp08.pdf\">http:\/\/www2.imm.dtu.dk\/courses\/02267\/slides\/weekp08.pdf<\/a><\/li>\n<li>David Chappell and Tyler Jewell, \u201cJava Web Services\u201d, First Edition, O&#8217;Reilly, 2002<\/li>\n<li>\u00a0Paul J. Deitel, Harvey Deitel, \u201cJava How to Program\u201d, Ninth Edition, Pearson,2012.<\/li>\n<\/ul>\n","protected":false},"author":4,"menu_order":36,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-s-abirami"],"pb_section_license":""},"chapter-type":[],"contributor":[59],"license":[],"class_list":["post-364","chapter","type-chapter","status-publish","hentry","contributor-dr-s-abirami"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":4,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/364\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/364\/revisions\/622"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/364\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/media?parent=364"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapter-type?post=364"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/contributor?post=364"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/license?post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}