Testing Your Application with Test View

The Test View page is loaded in your web browser when you build and run a web service or page flow from WebLogic Workshop. You can use Test View to test your component.

Testing Page Flows

If you are testing a page flow, Test View functions like a web browser. You can navigate through all of the pages that make up your page flow and test the functionality of individual pages and the flow of data across pages.

Note that the first time you try to run a JSP page by clicking on the Start button, WebLogic Workshop displays a message saying that the corresponding page flow will be run instead. You can test just an individual JSP page by right-clicking on the JSP page and choosing Run JSP Page.

Testing Web Services

Test View has four tabs that provide information about a web service:

By default, the Test Form tab is selected when you load Test View by clicking on the Start button.

In addition, each page lists the URL of the web service being tested. Each segment of the URL is a link to the WebLogic Workshop Directory at that level of the application. The WebLogic Workshop Directory is a page that lists the files in each level of the project directory. You may access it directly at any level via the URL http://<server>:<port>/AppName[/folder]/wlwdir.

Overview Tab

The Overview tab displays public information about the web service, including:

Note: To learn how the comments associated with each method are obtained, and how you can document your web service's methods, see Documenting Web Services.

Console Tab

The Console tab displays private information about your service, including:

Test Form Tab

The Test Form tab provides a simple test environment for the public methods of the web service. You can provide parameters for a method and examine its return value. You can also track and test the different parts of a conversation.

Note: The Test Form tab may only be used for web services (or methods of web services) that support HTTP-GET. Web service methods that do not support GET or that receive raw XML messages must be exercises via the Test XML tab.

The following image shows how the Test Form tab appears for a service called HelloWorldAsync, which demonstrates a simple conversation:

To test the service, click the HelloAsync button. If this method took parameters, you would enter values for them here.

The Test Form page displays information about the service request and response, including the XML message that was returned, as shown in the following image:

If the web service implements conversations, as the HelloWorldAsync service does, you can use Test View to test the methods that start, continue, or finish a conversation and the callbacks that continue or finish a conversation. You can also test multiple conversations at once.

The conversation ID that appears in the message log uniquely identifies each conversation that is underway. Click on this value to select and work with this conversation. You can view the results for each method or callback that has participated in this conversation by clicking on its name in the list. Click the Refresh link to refresh the message log.

The following image shows Test View with multiple conversations underway:

Note: To learn how the comments associated with each method are obtained, and how you can document your web service's methods, see Documenting Web Services.

Test XML Tab

The Test XML tab shows the XML data that is being sent to your service when you test its methods. You can use this page to examine and modify the XML data that is passed to a method of your service.

If your method takes parameters of a data type other than String, you must modify the parameter placeholders in the SOAP body before you click the button to call the method. For example, if your method expects an integer, you must supply a valid integer in the SOAP body.

The following image shows the Test XML tab for a service called SimpleCalc, which performs simple arithmetic calculations:

 

WebLogic Workshop Directory

The WebLogic Workshop Directory contains a sortable list of the files that comprise the different levels of the Project directory. You can use this page to select another service to test, test a control file, and clean up the service.

There are two ways to navigate to the service directory:

You can use the WebLogic Workshop Directory to:

Testing Callbacks

If your control exposes callbacks, you need to take extra steps for testing.

The test interface can receive the request, but it cannot respond to it because it does not implement the callback interface set by the service. If the service is invoked from the test interface, the callback request is never sent. Because the request is never sent, the handlers are never invoked.

If the service with the callback handlers is invoked via a service control, then the callback handlers get invoked. So, to test callbacks, the callback handlers must be tested from a client that implements the callback interface. To do this you might create callbacks within the test JWS, then call these from your control's callback handlers.

 

Related Topics

Web Service Development Cycle