Step 4: Test the Web Service

In this section, you will start the server and then use the server's built-in test functionality to test the web service you created in the preceding sections..

To Start the Server

To Test a Web Service

A web service does not do anything unless a request is received from a client. For testing your web service, Workshop provides a test client through which you can send messages to the service and review the response message. The test client runs in the IDE as an editor window.

To test the web service:

  1. In the Project Explorer view, expand the services package.
  2. Right-click MailingListService.java and select Run As > Run On Server.
  3. In the Run On Server dialog, select the Always use this server when running this project check box. This will reduce the number of steps in the next part of this tutorial, as the IDE will remember your server choice.
  4. Click Finish.
  5. After the server starts and the application is deployed (note the status bar in the lower right corner of the IDE), the IDE displays the test client as shown here:
  6. Test Client

    This web service has only one operation (getCustomers). If there were input values required by getCustomers, there would be input fields that would allow you to specify values. Clicking the getCustomers button sends a request message to the web service.

  7. Click the getCustomers button now to invoke the getCustomers method.

    The test client displays the results of invoking the web service operation (including the returned value) and also the detail of the SOAP-encoded request that was sent to the web service and the response that was received, including the string returned by the getCustomers operation/method: "John Smith".

    Test client results

  8. You can test your web service operation again by clicking Show Operations at the top left corner. You can also examine the automatically generated WSDL (Web Service Description Language) file by clicking the link at the top of the Test Client page.

Click the arrow to navigate through the tutorial:


Still need help? Post a question on the Workshop newsgroup.