Testing the Web Service

Once you've deployed the web service, you can test it without creating a client. Oracle 10g AS provides a useful browser-based view of the web service that makes web-service testing simple.

To test your web service, point your browser at http://localhost:8888/ws. Obviously if you used a different server or a different context path , then your URL will be different. Once your browser loads the page, you'll be presented with a screen similar to the one shown in Figure 13-1.

image from book
Figure 13-1: Home page for the echo web service

WSA creates this simple home page for your services (so if you've deployed the services manually then you won't have this). Clicking either of the links will take you to the home page for that specific service. In Figure 13-2 you can see the home page for the stateful web service.

image from book
Figure 13-2: Home page for the stateful echo service

The service page contains three sections. The top section contains a link to the WSDL file for your service, which is generated automatically by Oracle 10g AS. This file is useful to clients that wish to use the service and can be used by many different tools to automatically generate a proxy for the web service. The second section contains links to all the operations of the web service. As you'll see, you can use these links to test the operations of your web service from your browser. The final section contains links to the proxy JAR file and the proxy source for this web service. Oracle 10g AS automatically creates a Java-based proxy for your web service and provides a prepackaged JAR file and the source through these links. We'll discuss the use of the proxy in more detail in the following sections.

Testing the Echo Operation

From the service page click the link for the echo operation. This will take you to the echo operation page, as shown in Figure 3-3.

image from book
Figure 13-3: The echo operation page

As you can see, Oracle has identified that the echo operation accepts a single String parameter and has kindly provided you with a box in which you can enter the value of that parameter. Enter a value for param0 and click the Invoke button. A new window should appear, displaying the result of the echo operation, as shown in Figure 13-4.

image from book
Figure 13-4: The results of the echo operation

The <result> tag of the XML output indicates the specific outcome of the operation. Because you're testing the stateful service, invoking this operation again will increase the number tagged on the end of the Hello World! string by one.

As you can see, the ability to access and invoke your web services via a browser provides a useful mechanism for testing web-service functionality. Of course this testing will only take you so farto get some real use from your web service, you need to build a client application. In the next section we'll discuss three approaches to building web-service clients. We'll discuss two Java-based approaches, one using the Apache Axis libraries and the other using the Oracle 10g AS-generated proxy library. For the final approach you'll use Microsoft .NET and C# to build a simple console-based client for the Windows platform.



Oracle Application Server 10g. J2EE Deployment and Administration
Oracle Application Server 10g: J2EE Deployment and Administration
ISBN: 1590592352
EAN: 2147483647
Year: 2004
Pages: 150

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