In this step you are going to test the two controls and examine whether
their behavior is as intended. To do so, you must
create
a client application, such as a web application, to invoke the custom control.
Here you will build a test web service instead.
The tasks in this step are:
To Create the Web Service Project
Web service development is done in a separate project in the application.
-
In the Application tab, right-click the GettingStarted_Control folder
and select New-->Project.
- In the New Project dialog, in the upper left-hand
pane, select Web Services.
In the upper right-hand pane, select Web Service Project.
In the Project Name field, enter MyControlTestProject.

-
Click Create.
- In the Application tab, right-click MyControlTestProject and
select New-->Folder.
Enter hello.
- Click OK.
To Generate the Test
Web Service
A test web service is a web service that
exposes the methods of a control. In this particular case the test
web service is a client application
that calls the methods on the custom control Hello.
To learn more about web services, see the Getting
Started Tutorial: Web Services.
-
In the
Application tab, right-click
HelloImpl.jcs and
select
Generate Test JWS File (Stateless). The following
message appears:

- Click OK. The file HelloTest.jws is
created.
-
In the
Application tab, drag and drop
HelloTest.jws to
the
hello folder in
MyControlTestProject.

-
The test web service
HelloTest has
now been moved to the web service project. The
Application pane
should look like this:
In the
Application tab, double-click
HelloTest.jws to open the
test web service in Design View

To Run the Test Web Service
Let's run the test web service and test the behavior of the Java controls.
- Make sure the HelloTest web
service is open.
-
Click the
Start button.
Workshop launches the Workshop Test Browser.
- If this is the first time you have ever run this application, click
the createTable button to make the table the database
control is going to query.
- Scroll down to the Service Response section, and
notice that no exceptions are thrown.
- Scroll back up and click the Test Operations link.
- Enter your name in the String field
and click the hello button.
-
Scroll down to the Service Response section,
and notice that the response is Hello, <your
name>!
In the preceding two steps the web service invoked the hello method
on the custom control. The control called the getVisits method
of the VisitDB database control to find out the number of previous
visits. Because you were running this test for the first time, this
method returned 0, your name was added to the database using the database
controls insertVisitor method,
and
the Hello control returned the appropriate response.
-
Click the Test Operations link,
enter
your name again, click the hello button,
and notice that the response is Hello again, <your
name>!
In this step the Hello control again invoked the getVisits method
of the VisitDB database control to find out the number of previous
visits.
This method returned 1, the database record was updated to reflect
that this
was
your
second
visit using the VisitDB's updateVisits method,
and
the Hello
control
returned
the
appropriate
response.
-
Click the Test Operations link,
enter your name again, click the hello button,
and notice that the response is Hello <your
name>! This is visit number 3.
- Repeat the test with a different name and observe the outcome.
- Return to WebLogic Workshop and press the Stop button
to close the Test Browser.
Click one of the following arrows to navigate through the tutorial: