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 standards-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 bookstore 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. - Disable Create Functional Tests from the WSDL and enable Create tests to validate and enforce policies on the WSDL.
- Click Finish. Because you enabled Create tests to validate and enforce policies on the WSDL, 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.
- Click the Test 3: WS-I Interoperability Check node and click the Add test or output... toolbar button.
This opens the Add Output wizard, which shows a list of available tools. In addition, a description of the selected tool is shown in the Tool Description field. - In the Add Output wizard, choose Conformance Report in the left pane and Browse in the right pane, then click Finish. 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 Run Tests toolbar button.
If any errors occur, they will appear in the Console tab located at the bottom of the SOAtest GUI. For more information about an error, double-click its node.