Getting Started › CA Application Test Tutorials › Tutorial 8 - Test a Web Service
Tutorial 8 - Test a Web Service
In this tutorial, you use the Web Service Execution (XML) test step to call web service operations in a test case. You then test the request and response. These web service operations provide the same functionality as the equivalent method calls in the EJB used in Tutorial 7.
Tutorial Tasks
In this tutorial, you:
- Add the Web Service Execution (XML) test step.
- Execute a web service operation.
Prerequisites
- You have completed Tutorial 5.
- DevTest Workstation is open.
- You have access to the demo server.
Step 1 - Create a Test Case
Follow these steps:
- Right-click on the Tests folder in the Project panel, and select Create New Test Case.
- Set the file name to tutorial8.
- Click Save.
- In the Project panel, right-click on project.config and select Make active.
Step 2 - Add a Web Service Execution (XML) Test Step
The Web Service Execution (XML) test step enables you to execute an operation on a SOAP-based web service.
Follow these steps:
- Click the tutorial8a tab.
- Click Add Step.
- Select Web/Web Services and select Web Service Execution (XML).
A Web Service step is added to the model editor.
- To open the Web Service Execution (XML) editor, double-click the Web Service step.
- Click New Document.
Step 3 - Create a Web Service Client
Now specify the operation to be called, and create a SOAP message to send to the operation.
Follow these steps:
- In the WSDL URL field, enter the following location.
Note: The WSSERVER and WSPORT properties represent the server and port.
http://localhost:8080/itko-examples/services/UserControlService?wsdl
- In the Service field, select UserControlServiceService.
- In the Port field, select UserControlService.
- In the Operation field, select the addUser operation.
- In the On Error field, select Abort the Test.
DevTest uses this criteria to build the web service client. The Visual XML editor shows a graphical view of the SOAP message.
- Save the test case.
Step 4 - Execute the Web Service Request
Follow these steps:
- Click Execute WS Request.
The test is executed.
Step 5 - View the Request and Response
The Request tab shows the resulting request data that was sent after any post processing (for example, substituting DevTest properties). The Response tab shows the resulting response data that was received.
Follow these steps:
- To view the request upon execution, click the Request tab.
- To view the response upon execution, select the Response tab.
Tutorial 8 - Review
In this tutorial, you:
- Created a test case with the Web Service Execution (XML) test step.
- Executed the addUser operation.
- Viewed the request and response for this operation.
Copyright © 2014 CA Technologies.
All rights reserved.
|
|