Jump to: navigation, search

WSDL Validator

Revision as of 13:13, 2 November 2006 by Lmandel.ca.ibm.com (Talk | contribs)

Overview

The WSDL validator provides, as you should expect, the ability to validate WSDL documents (as of WTP 1.5.2, WSDL 1.1 documents). This validator differs from most other WTP validators in that at its core it does not depend on Eclipse or OSGI. The WSDL validator can be run outside of Eclipse (see Using the WSDL Validator Outside of Eclipse) and is also integrated with the WTP validation and URI resolution frameworks when used within Eclipse.

WSDL validation can be thought of as a three step process: 1. Check the WSDL document for XML well formedness. (That is, ensure all tags are properly nested and closed.) 2. Validate the WSDL document against its XML schema. 3. Validate the WSDL document using semantic rules defined in the WSDL specification. An optional fourth step is: 4. Validate the WSDL document against custom validation rules, such as those defined by the Web Services Interoperability (WS-I) organization.

The WSDL validator handles validation according to the 4 step process defined above. Steps 1 and 2 are both delegated to Apache Xerces (and XML parser). Step 3 is handled by the WSDL validator and any extension namespace validators (more on extensions below). Step 4 is handled by any declared custom validators (more on this below as well). Each step must pass in order for the next step to run. Here are a few examples:

WSDL Validation Example 1

The following WSDL document is validated:

 <definitions wsdl="http://schemas.xmlsoap.org/wsdl/"
            targetNamespace="http://www.eclipse.org/service/"
            xmlns:tns="http://www.example.org/service/">
   <message>
 </definitions>

In this case the WSDL validator will fail at step 1 because the document is not well formed. (The message element is not closed properly.) Xerces will produce an error, which the WSDL validator will output.

WSDL Validation Example 2

The following WSDL document is validated:

 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
            targetNamespace="http://www.eclipse.org/service/"
            xmlns:tns="http://www.example.org/service/">
   <message>
   </message>
 </definitions>

In this case the WSDL validator will fail at step 2 because the document is not valid according to the WSDL schema. (The message element must have a name.) Xerces will produce an error, which the WSDL validator will output.

WSDL Validation Example 3

The following WSDL document is validated:

 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
            targetNamespace="http://www.eclipse.org/service/"
            xmlns:tns="http://www.example.org/service/">
   <message name="message">
   </message>
   <portType name="portType">
     <operation name="operation">
       <input message="invalidmessage"/>
     </operation>
   </portType>
 </definitions>

In this case the WSDL validator will fail at step 3 because the document is not valid according to the WSDL semantic rules defined by the WSDL 1.1 specification. (The input refers to an invalid message.) Here the WSDL validator will produce and output an error from its internal logic.

Architecture

The WSDL validator architecture was created with extensibility in mind. This means that the validator is composed of subcomponents that can potentially be added to or swapped out and replaced. (I use the term 'potentially' as some of the subcomponents can currently be added to/swaped through extensions and others can't.)

The following tree shows how control passes in the validator:

WSDLValidator
| --> ValidationController
| | --> WSDL11BasicValidator (IWSDLValidator)
| | | --> HTTPValidator (IWSDL11Validator)
| | | --> SOAPValidator (IWSDL11Validator)
| | | --> MIMEValidator (IWSDL11Validator)
| | | --> InlineSchemaValidator (IWSDL11Validator)
| | --> Other IWSDL11Validators including extension validators

The main entry point to the WSDL validator is the WSDLValidator class. This class delegates to the ValidationController to handle the rest of the validation processing. The ValidationController will perform steps 1 and 2 of validation by delegating to an XML validator and will then request a validator for the namespace of the WSDL document. (At this time the only supported namespace is the WSDL 1.1 namespace but this mechanism is flexible to support future versions, such as WSDL 2.0.)

The architecture of the WSDL validator is largely based on the requirement that it be able to run standalone outside of Eclipse (in order to allow it to be used in other applications). Because of this requirement

Extensions