Finally, let’s modify our model class FacultyMBean.java. First let’s concentrate on the QueryFaculty() method. The function of this method is to:
1) Call our Web service operation QueryFaculty() to pick up a matching faculty record from the Faculty Table in our sample database.
2) Assign each queried column to the associated property defined in our Java managed bean class FacultyMBean.java.
Open the file FacultyMBean.java and perform the modifications as shown in Figure 9.38. The modified lines are in bold. This is the first part of the code of this class file. The second part’s code will be shown later. Let’s have a closer look at this piece of code to see how it works.
A. The class name is changed from FacultyQuery to FacultyMBean.
B. The type of the faculty image object is changed from the Blob to the byte[[] array.
C. A new instance of our Web Service class is generated with a new Web Service port.
D. Our second operation in our Web Service project, QueryImage(), is executed to get the selected faculty image and assign it to the image byte array fbimg, which is used later.
Also, delete the whole body for the method CloseDBConnection() from this Java Bean class. Now let’s take a look at our second part of code for this model class file, which is shown in Figure 9.39. The modified parts are in bold. In fact, only the contents of one method, getFacul-tyImage(), are modified. The function of this method is to convert the faculty image file from the byte[] array to a specified image format, base64Image, to enable it to be displayed in the Faculty Image box in our view class Faculty.jsp page. The setBase64Image() method is to set this converted image to the property base64Image defined in this class, which can be used by the
image source tag in our view class later.

FIGURE 9.38 The completed code for the QueryFaculty() method.
At this point, we have completed all modifications for our three files. Before we can continue to build our project to call our Web Service, that is, to call related operations in our Web Service project to perform faculty data query from our sample database, we need to add our Web Service as a reference to our client project to enable the latter to recognize the former.
Now let’s add a Web reference to our current Web-based client project to enable our client to know our Web service and its operations.