Testing Web Services

Now that you have deployed your Web Service to an application server, it s time to test your Web Service. Ultimately you will want to write a client or at least a sample client to provide to your customers or vendors (i.e., users of the Web Service), but the quickest way to test the Web Service is via the Web Service home page.

Web Service Home Page

For each Web Service that you deploy, Oracle s Application Server automatically generates a supporting Web Service home page. The home page includes a link to the WSDL file, a link to each available method, and proxy links. If you forgot the URL to access each of your Web Services, simply double-click the Web Service and click the File Locations tab. As you can see in 17-22, the Web Service endpoint field contains the URL.

For each of our three examples, the respective URLs are

  • http://tuscbdb3.tusc.com:8888/Oracle10gWebServices-Project-context-root/DatabaseStatus

  • http://tuscbdb3.tusc.com:8888/Oracle10gWebServices-Project-context-root/DOMESTICTAPI

  • http://tuscbdb3.tusc.com:8888/Oracle10gWebServices-Project-context-root/COMPANY

Breaking down the above URLs:

  • http:// Hypertext transfer protocol that is used to access the application server from a browser (or client, too).

  • tuscbdb3.tusc.com Name (including the domain name ) of our application server.

  • 8888 Port the application service is running on.

  • Oracle10 g WebServices-Project-context-root Root directory for our Web Services.

  • DatabaseStatus, DOMESTICTAPI, and COMPANY Names of the specific Web Service.

We executed the DatabaseStatus URL, which resulted in a browser page showing the available methods (only one for this Web Service), as shown in Figure 17-27. Next , we clicked the databaseUp method, then entered a number of values, as shown in Figure 17-28. Finally, we executed the Web Service by clicking the Invoke button. You can see the results (in XML) of the invocation in Figure 17-29. As you can see from the result set, this procedure returns a Boolean (i.e., true or false) result.

click to expand
Figure 17-27: DatabaseStatus browser home page filled in
click to expand
Figure 17-28: databaseUp method s home page
click to expand
Figure 17-29: Results of the databaseUp method Web Service execution

We executed the DOMESTICTAPI URL, which resulted in the browser page showing the available methods, as depicted in Figure 17-30. This class required that we execute the openWebService, noLocalDB, and openTable methods before we could execute the fetchTableSet method. Finally, we executed the fetchTableSet method by clicking the Invoke button after entering the number of rows to return. You can see the results (in XML) of the invocation in Figure 17-31, which only shows a partial row from the DOMESTIC spreadsheet. If we execute the fetchTableSet method again within 20 seconds, we ll retrieve the next set of records from the DOMESTIC spreadsheet. Otherwise, the data set will again start at the beginning.

click to expand
Figure 17-30: DOMETICTAPI browser home page filled in
click to expand
Figure 17-31: Results of the fetch TableSet method execution

We executed the COMPANY URL, and then added an employee using the addEmp method. Next, we executed the getEmp method using an ID of 1, then clicked the Invoke button. You can see the results (in XML) of the invocation in Figure 17-32.

click to expand
Figure 17-32: Results of the getEmp method s execution


Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net