Step 4. Test the JAX-WS WebLogic Web Service 

Time to complete this step: 20 minutes

In this step, you will deploy the TroubleTicketSystemServer JAX-WS WebLogic Web Services developed in previous step to the  Oracle WebLogic Server 10gR3. You will use the WebLogic Test Client for testing the web services. 

Before testing the web services, make sure that the TroubleTicketSystemEAR is configured on the Oracle WebLogic Server 10gR3. If it is not configured then follow the Create Server for Deployment part in the Step 1. of this tutorial.

You will perform the following tasks in this step:


Deploy and test the LoginWebService  

  1. In the Project Explorer view, right-click the  LoginWebService class and select Run As > Run on Server

  2. This opens the Run on Server wizard dialog to select which server to use for deploying the  LoginWebService. Since, the TroubleTicketSystemEAR application is already configured on the Oracle WebLogic Server 10gR3, you can click Finish. If its not then click Next and add the TroubleTicketSystemEAR application. 

  3. That starts the Oracle WebLogic Server 10gR3 and deploys the TroubleTicketSystemEAR application. You can see the server log messages in the Eclipse Console view. Once, the server has started and has successfully deployed the application, it opens the WebLogic Test Client in Eclipse for testing the deployed LoginWebService.

  4. The WebLogic Test Client page provides a URL of the WSDL and lists all the operations offered by the deployed JAX-WS web service. Click on the WSDL URL and review the WSDL for LoginWebServiceService.

  5. Click the Back   button to go back to the previous page for testing the  login() web service operation. First, we will test with valid login parameters. Enter  peter as the id and pwd paramters. 

  6. Click the login button. Verify the SOAP envelope for the service request and service response.

  7. Click the Back   button to go back to the previous page for testing the  login() web service operation. Now, we will test with invalid login parameters. Enter  xyz as the id and pwd parameters. 

  8. Click the login button. Verify the SOAP envelope for the service request and service response. The service response envelope has a fault element with the faultstring  child element describing the reason for the failure. The  login()  method of the  LoginSpringDelegate throws an exception, if the given technician ID or password is invalid. 


Deploy and test the ProductWebService  

  1. In  Project Explorer view, right-click the  ProductWebService class and select Run As > Run on Server. 
  2. That opens the Run on Server wizard dialog to select which server to use for deploying the  ProductWebService. Since, the TroubleTicketSystemEAR application is already configured and deployed on Oracle WebLogic Server 10gR3, you can click Finish.
  3. That opens the WebLogic Test Client in Eclipse for testing the deployed ProductWebService.

  4. The WebLogic Test Client page for the ProductWebService provides a URL of the WSDL and lists all of the operations offered by the  ProductWebService. Click on the WSDL URL and review the WSDL for  ProductWebService. After reviewing the WSDL, click the Back   button to go back to previous page for testing the web service operations.
  5. First, we will test the  getAllProducts() operation. Click the getAllProducts button. Verify the SOAP envelope for the service request and service response. The response envelope lists all of the existing products.

  6. Click the Back   button to go back to the previous page. Enter 1001 as the product id and click the getProduct button. Verify that the SOAP envelope for the service request and service response describes the product with id 1001 .


Deploy and test the TicketWebService  

  1. In the Project Explorer view, right-click the  TicketWebService class and select Run As > Run on Server. 
  2. That opens the Run on Server wizard dialog to select which server to use for deploying the  TicketWebService. Since, the TroubleTicketSystemEAR application is already configured and deployed on Oracle WebLogic Server 10gR3, you can click Finish.
  3. That opens the WebLogic Test Client in Eclipse for testing the deployed TicketWebService.

  4. The WebLogic Test Client page for  TicketWebService provides a URL of the WSDL and lists all of the operations offered by the  TicketWebService. Click on the WSDL URL and review the WSDL for the TicketWebService. After reviewing the WSDL, click the Back   button to go back to previous page for testing web service operations.
  5. First, perform the  add() web service operation with the following input parameters:
  6. Click the  add button. Verify the SOAP envelope for the service request and service response describing the newly created ticket. Note the ID of the newly created ticket. We will use that as the input for other web service operations. Click the Back   button to go back to the previous page.
  7. For the  get() web service operation, enter the ID of newly created ticket and click the get button. Verify the SOAP envelope for the service request and service response describing the ticket for the given ticket ID.  Click the Back   button to go back to the previous page.
  8. Click the getOpenTickets button. The web service response lists all the open tickets; i.e., tickets with either a NEW or OPEN state. Verify that the response has an entry for the newly created ticket, since that is not assigned to any technician.
  9. For the  getTicketsOwnedByTechnician() web service operation, enter the technician ID of peter and click the getTicketsOwnedByTechnician button. That returns a list of tickets owned by the technician peter. You can also review the ticket history for the tickets returned.
  10. The  update() web service operation helps technicians to either accept or release a specific ticket. Update the newly created ticket with the following parameters: 
    • tickerId =>  <<enter the ID of the newly created ticket>> 
    • technicianId => peter
    • comment => accepting the ticket 
    • state => ASSIGNED
  11. Click the  update button. Verify the SOAP envelope for the service request and service response for the updated ticket. The updated ticket has now a ticket history entry.
  12. To verify the ticket being added/updated, you can switch to the JPA perspective and connect the TroubleTicketSystemDBConnection in the DataSource Explorer view, if thats not connected.
  13. Navigate to the TroubleTicketSystemDBConnection > orcl > Schemas > TroubleTicketUser > Tables > Ticket. Right-click the Ticket table and select Open from the context menu.
  14. Switch to the Data tab in the Ticket editor and verify a new entry for the ticket being added and now assigned to the technician peter.

Click the arrow below to navigate through the tutorial: