It is rather common to see WSDLs that contain XML Schema components within the wsdl:types section, as opposed to a simple schema reference to one or more external XSD files. There are many theories as to why the whole set of XSD definitions is sometimes entirely within the WSDL; the explanations vary from interoperability reasons dating back in the days where most people would use the wsdl:import to reference an XML Schema file, to shortcomings in various tools implementations, and simplified deployment procedures.
Most mainstream editors supporting XML automatically support XSD and WSDL; XML validation using XSD is also the norm. Yet, while a wsdl:types section is inherently a standard way (as much as WSDL itself is a standard) to logically put together XSD content, validation of an XML using the abstract part of the WSDL is virtually a non-existent feature.
For those trying to validate XML using an WSDL file, QTAssistant provides two mechanisms; the one discussed here is providing an answer to the most frequently asked question: "How do I extract XSD from WSDL to validate XML?"
|
QTAssistant supports XML validation using RELAX NG, XSD 1.0 and 1.1, and Schematron. It also supports WSDL 1.1, as an indirection mechanism to an XSD 1.0 schema collection. In addition to providing a convenience method for scenarios where XSDs are (mostly) embedded within the WSDL itself, it also makes use of the additional metadata present in the wsdl:message elements to filter out those elements/types that are not supposed to describe a valid instance of a message. |
The command Extract XSDs is available in the Tools tab, WSDL command group, Refactor drop-down menu.
The command presents the following prompt.
The command prompt is designed to capture the following inputs and commnands:
|
The file location; it can be local file or a URI |
|
Credentials/Proxy Server information. Use this panel to enter remote network credentials, and/or proxy server address and credentials. |
|
The output directory. |
|
Load command button. Press this button to initiate the discovery process. This will attempt to download, parse and recurrently load all external references. |
|
External references panel. This panel is populated with the list of discovered resources, and their individual mappings based on the output directory. Each mapping may be independently overridden. |
Provide the information for the first three items and press the Load button. A progress bar is shown during a lengthy discovery process. This could be caused by large files over limited network bandwidth, server side throttle for certain XSD files, etc.
Once completed, the external references panel is populated with the content to be created. Each file location can be overridden.
Pressing the OK button will prompt the user if a new XSR with an XML Schema Collection to be optionally created for analysis and validation. This step is optional, regardless of the user pressing OK or Cancel, the files are still going to be created.
If the user chooses to generate a new XSR, the file will be automatically opened.