Previous Next vertical dots separating previous/next from contents/index/pdf

Step 4: Test the Web Service

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

Workshop for WebLogic creates a WebLogic Server as part of installation and we will use this local server for testing the application we will create in this tutorial. You must set up the server before you can test any applications.

To Set Up a Test Server

    If you are working through this tutorial for the first time, you must create a server definition for use within the IDE and add the ServicesWebEAR to that server. To set up a server definition, follow the instructions at Setting up Servers for Use Within the IDE. Make sure to add the ServicesWebEAR project to the server once the server definition has been created.

    If you are working through this tutorial for a second time, you must remove previous, duplicate projects (modules) from the server

To Test a Web Service

Unlike a page flow or application, a web service does not do anything unless a request is received from a client. For testing your web service, Workshop for WebLogic provides a test client that allows you to send messages to the service and review the response message. The test client runs in the workbench, as an editor window.

To test the web service:

  1. In the Package Explorer view, if the services package is not expanded, expand it now.
  2. Right-click MailingListService.java and select Run As > Run On Server.
  3. We recommend that you check the box marked Set server as project default. This will reduce the number of steps in the next part of this tutorial, as the IDE will remember your server choice. Click Finish.
  4. Wait for the server to startup and the application to deploy.
    You will see the test client display:

    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 on the getCustomers button sends a request message to the web service.

  5. 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".

  6. You can return to testing your web service operation by clicking on Show Operations at the top left corner. You may also examine the automatically generated WSDL (Web Service Description Language) file by clicking on the link to the right of the Show Operations link.

 

Click the arrow to navigate through the tutorial:

 

Skip navigation bar   Back to Top