Blog / Deploy and Test the Web Service Project – Develop Java Web Services to Access Databases

Deploy and Test the Web Service Project – Develop Java Web Services to Access Databases

Deploy and Test the Web Service Project – Develop Java Web Services to Access Databases


9.11.3   Deploy and Test the Web Service Project

Perform the following operations to build and deploy our Web service project:

  1. Click on the Clean and Build Main Project button to build our Web service.
  2. Right-click on our Web application, WebAppFaculty, and select the Deploy item to deploy our Web service. If everything is fine, a successful deployment result is displayed.

A problem arises when testing the UpdateFaculty() operation of this Web service using the tester page, which is the input parameter array fdata. As we know, fdata has a data type of ArrayList, and it needs to 1) create an ArrayList instance and then 2) assign a set of updated fac-ulty information to that ArrayList object to call the Web service operation UpdateFaculty() to perform the faculty data update. However, it is difficult to do those two operations manually by using this tester page. Therefore we need to create a Web client project to consume and test the update operation later.

To test the DeleteFaculty() operation, just right-click on our Web service output file, WebServiceFaculty, under the Web Services node in the Projects window, and choose the Test Web Service item to open the tester page.

Enter a desired faculty name, such as Charley David, which was inserted into our sample database in Section 9.10.3 when we tested our InsertFaculty() operation, into the text field that is next to the deleteFaculty button, and click on the deleteFaculty button to perform this faculty data delete action.

The test result is shown in Figure 9.59. A true is returned and this indicates that our data delete action is successful.

To confirm the data delete action, open our Faculty Table by going to the Services window and expand the Databases node, our connection URL and finally our sample database, CSE _ DEPT. Expand our database Tables and right-click on the Faculty Table. Select the View Data item from the popup menu to open our Faculty Table. In the opened Faculty Table, you can see that the faculty record with the faculty name Charley David has been removed from this Table.

But the story is not finished yet. The deleted faculty member, Charley David, is not an origi-nal faculty record in our sample database. This means that this faculty record was not an original record when we built our sample database in Chapter 2; instead, it was inserted when we tested our data insertion action in the last section, Section 9.10.3. Therefore, this faculty member has no rela-tional data columns with any other Tables in our sample database.

FIGURE 9.59   The test result of the delete operation.

Angela Gaffney

  • 0

Leave a Reply

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


                Copyright © 2024 Saucierlight.com. All Rights Reserved.