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
- In the
Project Explorer view, right-click the
LoginWebService class and select
Run As > Run on Server .
- 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.
- 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.
- 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.
- 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.
- Click the
login button. Verify the SOAP envelope for the service request and service response.
- 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.
- 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
- In
Project Explorer view, right-click the
ProductWebService class and select
Run As > Run on Server.
- 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.
- That opens the
WebLogic Test Client in Eclipse for testing the deployed
ProductWebService.
- 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.
- 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.
- 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
- In the
Project Explorer view, right-click the
TicketWebService class and select
Run As > Run on Server.
- 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.
- That opens the
WebLogic Test Client in Eclipse for testing the deployed
TicketWebService.
- 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.
- First, perform the
add() web service operation with the following input parameters:
- productId => 2001
- customerName => Jeff
- customerEmail =>
jeff@email.com
- title => OEPE error when creating weblogic 10g server
- description => OEPE fails with error while creating a new weblogic 10g server.
- 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.
- 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.
- 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.
- 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.
- 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
- 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.
- 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.
- Navigate to the
TroubleTicketSystemDBConnection > orcl > Schemas > TroubleTicketUser > Tables > Ticket. Right-click the
Ticket table and select
Open from the context menu.
- 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: