E. A pre-checking action is performed to make sure that the input argument to this method is not empty, in other words, that a valid faculty name is included.
F. A try-catch block is used to call our Web operation QueryCourseID() to get all course _ id via our Web service. First a new Web service instance, service, is cre-ated based on our Web service class, WebServiceCourse _ Service. Then a system method, getWebServiceCoursePort(), is executed to get the current port used by our Web service. This port is returned and assigned to a new port instance, port.
G. The ArrayList instance al is cleaned up by using the clear() method to make sure that al is empty before it can be used to store any data.
H. Our Web Service operation QueryCourseID() is executed with a selected faculty name as the argument, and the query results are assigned to our ArrayList object, al.
I. A for() loop is used to collect all queried course _ id from the ArrayList instance al and add each of them into our HashMap instance sCourse with a pair of an index and a value; both are the String data type.
J. A user-defined method, setCourse(), is executed to assign the sCourse result to our class member c _ course, which is a HashMap object defined in our CourseQuery class. Another user-defined method, setFacultyName(), is used to set the selected faculty name during the Web page refresh process.
K. A catch block is used to track and detect any possible exception during this query pro-cess, and the resulting HashMap instance will be set to null if any error occurs.
L. Another user-defined method, QueryCourse(), which is used to query the details for a selected CourseID, is declared with the argument cid, which is an input course _ id. Also an ArrayList instance, al, is generated, and it is used to store the queried course details later.
M. A try-catch block is used to call our Web operation QueryCourse() to get all details for a selected course via our Web service. First a new Web service instance, ser-vice, is created based on our Web service class WebServiceCourse _ Service. Then the system method getWebServiceCoursePort() is executed to get the cur-rent port used by our Web service. This port is returned and assigned to a new port instance, port.
N. The ArrayList instance al is cleaned up by using the clear() method to make sure that al is empty before it can be used to store any data.
O. Our Web Service operation, QueryCourse(), is executed with a selected course _ id as the argument, and the query results are assigned to our ArrayList object, al.
P. A sequence of system methods, get(), is used to pick up each item of the queried course details in al and assign each of them to the related class variable. One point to be noted is the order of these assignments, and it must be identical to the column order in our Course Table in our sample database, CSE _ DEPT.
Q. A true is returned to indicate that this query is successful.
R. The catch block is used to track and detect any possible exception during this query process, and a false would be returned if any error occurs.
Now let’s do some modifications to the second part of the code for our Java Bean class. Just add three user-defined methods, as shown in Figure 9.101, into our CourseQuery class. No explana-tions need to be given due to the simplicity of these methods.
Next let’s modify the control class CourseProcess.jsp page. Open the code win-dow for that page, and the only modification to that page is to remove the code cQuery. CloseDBConnection();, which is located at line 59 on that page, since we removed that method from our Java Bean class file in the previous operations.
Now we have completed all code development for our client project. Next let’s build and run our project to consume our Web Service to query the Course Table in our sample database.

