Blog / Build and Run the Web Service to Test the CourseID Query Function – Develop Java Web Services to Access Databases

Build and Run the Web Service to Test the CourseID Query Function – Develop Java Web Services to Access Databases

Build and Run the Web Service to Test the CourseID Query Function – Develop Java Web Services to Access Databases


9.14.4.2  Build and Run the Web Service to Test the CourseID Query Function

Prior to building and running our Web Service to test its function, we need to add our Java JDBC Driver, ojdbc8.jar, that is located in the folder C:\Temp. Refer to Appendix H to get more details about downloading and installing this driver. Perform the following operations to add this JDBC driver into our Web Service project:

1) Right-click on our Web application, WebAppCourse, in the Projects window and select the Properties item to open its Properties wizard.
2) Click on the Libraries node on the left under the Categories list.
3) Click on the Add JAR/Folder button on the right and browse to the location where our JDBC driver is stored, which is C:\Temp in our case.
4) Select the JDBC driver ojdbc8.jar and click on the Open button to add it into our project.

Now click on the Clean and Build Main Project button at the top of the window to build our Web service project. Then right-click on our Web service application project WebAppCourse and choose the Deploy item to deploy our Web service.

If everything is fine, expand the Web Services node under our Web service project, right-click on our Web service target file WebServiceCourse and choose the Test Web Service item to run our Web service project. The run status of our Web service is shown in Figure 9.75.

Enter a desired faculty name, such as Jenney King, into the text field and click on the que-ryCourseID button to test the query function. The test result is shown in Figure 9.76.

It can be seen from Figure 9.76 that all course _ id taught by the selected faculty member Jenney King have been retrieved and displayed at the bottom of this page, and our course _ id query via Web service is successful!

Next let’s handle the creating and coding process for the second Web service operation, QueryCourse(), to query and get course details for the selected course _ id.

FIGURE 9.76  The test results of our Web Service project.

Angela Gaffney

  • 0

Leave a Reply

Your email address will not be published. Required fields are marked *


                Copyright © 2024 Saucierlight.com. All Rights Reserved.