WSDL verification can be considered the first step in testing web services. Although WSDLs are generally created automatically by various tools, that doesn’t necessarily mean the WSDLs are correct. When WSDLs are manually altered, WSDL verification becomes even more important.
Correct and compliant WSDLs enable your service consumers to function correctly and prevent vendor lock-in. This helps with interoperability and service reuse.
SOAtest can automatically generate a test suite of comprehensive WSDL tests to ensure that your WSDL conforms to the schema and passes XML validation tests. Additionally, it performs an interoperability check to verify that your web service will be interoperable with other WS-I compliant services.
When you complete this section of the tutorial, your test suite should resemble the test suite entitled "WSDL Tests" in the SOAtestTutorial.tst
file.
Creating a WSDL Verification Test Suite
For this example we will create WSDL tests for a book store service with the WSDL located at http://localhost:8080/parabank/services/store-01?wsdl.
To verify a WSDL using SOAtest’s WSDL Verification Tests:
- Create a new empty project and name it
Tutorial
:- Choose File> New> Project.
- Select General> Project.
- Click Next.
- Enter
Tutorial
under Project Name. - Click Finish.
- Add a new .tst to that project:
- Right-click the new Tutorial project node, then choose Add New> Test (.tst) File.
- Enter
Tutorial
under File name, then click Next. - Choose SOA> WSDL, then click Next.
- Type
http://localhost:8080/parabank/services/store-01?wsdl
as the WSDL URL. - Clear the Create Functional Tests from the WSDL check box and select the Create tests to validate and enforce policies on the WSDL check box.
- Click Finish. Because you selected the Create tests to validate and enforce policies on the WSDL check box, four WSDL tests are automatically created in a separate test suite called WSDL Tests. To see this test suite, open the Test Case Explorer tab and expand the tree.
SOAtest automatically creates the following WSDL tests from a WSDL URL.
- Test 1: Schema Validity: Runs XML validation on the WSDL against WSDL schemas from W3C.
- Test 2: Semantic Validity: Checks the correctness of the WSDL by parsing and consuming it like an actual service consumer would, but with stricter adherence to standards.
- Test 3: WS-I Interoperability: Checks WSDL conformance to the WS-I Basic Profile 2.0 (for SOAP 1.2), 1.2 (for SOAP 1.1) or 1.1 (also for SOAP 1.1).
- Test 4: WSDL Regression: Creates a regression control for the WSDL so that changes in the WSDL document can be detected.
- Select the Test 3: WS-I Interoperability Check node and click the Add test or output toolbar button.
This opens the Add Output wizard, which displays a list of available tools. In addition, a description of the selected tool displays in the Tool Description field. - In the Add Output wizard, select Conformance Report from the left pane, select Browse from the right pane, and click the Finish button. This will send a WS-I Conformance report to your browser when you run the test.
- Select the Test Suite: WSDL Tests node and click the Test toolbar button.
If any errors occur, they will display in the Console dialog located at the bottom of the SOAtest GUI. For more information about an error, double-click its node.