Testing your Web Service using the Web Services Explorer
December 12, 2008
In the first eleven parts of this series, Ive introduced you to some of the many features available within the IBM Data Studio integrated development environment (IDE) thats available for use with the IBM data servers. Specifically, Ive shown you how to set up and use database connection objects, the features available when working with these objects, how to generate an overview diagram of your database architecture, how to build OLE DB functions that can be used to easily integrate data from external data sources that have an OLE DB provider, and how to create an SQL statement using either the SQL Builder or the SQL Editor in IBM Data Studio. Ive also shown you how to take the FEMALEPERSONNEL SQL statement built in previous installments and quickly turn that into a stored procedure using IBM Data Studio, and finally how to wrap both the SQL statement and the stored procedure as a Web service.
In Part 11, I showed you how to use SOAP to invoke the SQL statement that you wrapped as a Web service. I have a lot more to show you because IBM Data Studio comes with a number of rich testing interfaces that make it easy to sanity check your Web services. In this article, Im going to delve into the Web Services Explorer, one of the testing facilities for your Web services that is included in IBM Data Studio Version 1.1 and Version 1.2. In Data Studio Version 1.2, the IBM Data Web Services Test Client became the preferred testing facility for IBM Data Web Services (IBM DWS); however, Im covering the Web Services Explorer in this article because many users are still running Data Studio Version 1.1. In the next part of this series, I will show you how to test your Web services using the IBM Data Web Services Test Client.
Getting ready for this article
I assume in this article that you performed the steps in DB2 9.5 and IBM Data Studio Part 11: Transforming Business Logic into a Web. From there, all you need to do in order to follow the steps in this article is ensure that the application server you defined and deployed your Web services to in Part 11 is started and running. The Servers tab should look like this:
Testing IBM Data Web Services in IBM Data Studio
In Data Studio Version 1.2, there are two testing facilities that help you test and perform quality assurance on your Web services. When you built and deployed your Web service in Part 11, you saw the Test box in the Deploy Web Service window:
The previous figure shows the same options that you used to create your Web services in Part 11. As you can see, your Web service was only enabled for testing using the Web Services Explorer. In order to select the Launch Web Services Explorer after deployment check box, you have to deploy the Web service to a server. (As you can see, the Server radio button is selected.) The Web Services Explorer testing option is not available if you select the Build deployable files only, do not deploy to a Web server radio button this restriction does not apply to the Data Web Services Test Client.
Using the Web Services Explorer to test a Web service
Since the Web service you created in Part 11 is enabled for testing using the Web Services Explorer, you can test your Web service by right-clicking the SOA_FEMALEPERSONNEL Web service project, and selecting Launch Web Services Explorer:
The Web Services Explorer window opens (and should look similar to the window you saw in Part 11). Test the FEMALEPERSONNEL Web service (it wraps the FEMALEPERSONNEL SQL statement) as you did in Part 11. To do this, select the appropriate Web service (note that you are selecting the SOAP invocation of this service) and click Go in the Actions pane. The results of this operation are shown in the Status pane.
As you can see, the Status pane shows the results of your Web service. You can maximize the Status pane view by double-clicking anywhere within the label. (See the highlighted rose portion of the figure below; I added the color for emphasis.)
Double-clicking the highlighted area again toggles the Status pane back to its regular size. You can see that the Web service test results are formatted for viewing this default presentation mode is referred to as the Form view in IBM Data Studio.
You can resize any of the panes in the Web Services Explorer by clicking within the rose areas shown below, and dragging a specific pane vertically or horizontally:
You can click Source in the Status pane to see the SOAP request and response envelopes for this SOAP-invoked Web service:
The SOAP Request Envelope is how an application would invoke the Web service using the SOAP protocol. The SOAP Response Envelope shows the response from the database to the application that invoked the Web service. As you can see, XML is at the core of SOAP response and request envelopes; for this reason, XML is often referred to as the payload for Web services.