Difference between revisions of "Using the WSDL Validator Outside of Eclipse"

From Eclipsepedia

Jump to: navigation, search
 
Line 2: Line 2:
  
 
WTP's WSDL validator validates WSDL 1.1 documents against the [http://www.w3.org/TR/wsdl WSDL 1.1 specification]. Through the [http://www.ws-i.org Web Services Interoperability (WS-I)] extension it can also validate against the WS-I [http://www.ws-i.org/Profiles/BasicProfile-1.1.html Basic Profile 1.1], [http://www.ws-i.org/Profiles/SimpleSoapBindingProfile-1.0-2004-08-24.html Simple SOAP Binding Profile 1.0] and [http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html Attachments Profile 1.0].
 
WTP's WSDL validator validates WSDL 1.1 documents against the [http://www.w3.org/TR/wsdl WSDL 1.1 specification]. Through the [http://www.ws-i.org Web Services Interoperability (WS-I)] extension it can also validate against the WS-I [http://www.ws-i.org/Profiles/BasicProfile-1.1.html Basic Profile 1.1], [http://www.ws-i.org/Profiles/SimpleSoapBindingProfile-1.0-2004-08-24.html Simple SOAP Binding Profile 1.0] and [http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html Attachments Profile 1.0].
 +
 +
The WSDL validator, available in all WTP downloads, is located in plug-in org.eclipse.wst.wsdl.validation.
  
 
== Validating WSDL Documents Programmatically ==
 
== Validating WSDL Documents Programmatically ==
  
The WSDL validator can be used programmatically both within and outside of Eclipse.
+
The WSDL validator can be used programmatically both within and outside of Eclipse.  
 +
 
 +
WSDL validation can be invoked as follows
 +
 
 +
<code>WSDLValidator validator = new WSDLValidator();<br/>
 +
IValidationReport report = validator.validate(URI, INPUTSTREAM, CONFIGURATION);</code>
 +
 
 +
The URI is actually a URL location representing the location of the document. The WSDL validator won't read from this location if an INPUTSTREAM is provided.<br/>
 +
The INPUTSTREAM is an optional inputstream that represents the URI location.<br/>
 +
The CONFIGURATION is a [http://dev.eclipse.org/viewcvs/index.cgi/wst/components/wsdl/plugins/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/WSDLValidationConfiguration.java?rev=1.2&cvsroot=WebTools_Project&content-type=text/vnd.viewcvs-markup WSDLValidationConfiguration], which can be used to pass properties to the validator and extension validators.<br/>
 +
The validator returns an [http://dev.eclipse.org/viewcvs/index.cgi/wst/components/wsdl/plugins/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/IValidationReport.java?rev=1.1&cvsroot=WebTools_Project&content-type=text/vnd.viewcvs-markup IValidationReport] that contains validation messages (errors and warnings) produced during validation.
 +
 
 +
The WSDLValidator also provides the method
 +
 
 +
<code>public void registerWSDL11Validator(String namespace, WSDL11ValidatorDelegate delegate)</code>
 +
 
 +
which allows you to register a validator for an extension WSDL 1.1 namespace. Validators for HTTP 1.1 GET and POST and SOAP 1.1 are already provided. When working outside of Eclipse you'll likely want to create a [http://dev.eclipse.org/viewcvs/index.cgi/wst/components/wsdl/plugins/org.eclipse.wst.wsdl.validation/src/org/eclipse/wst/wsdl/validation/internal/wsdl11/ClassloaderWSDL11ValidatorDelegate.java?rev=1.2&cvsroot=WebTools_Project&content-type=text/vnd.viewcvs-markup ClassloaderWSDL11ValidatorDelegate] as follows:
 +
 
 +
<code>WSDL11ValidatorDelegate delegate = new ClassloaderWSDL11ValidatorDelegate("org.example.extension.WSDLValidator");</code>
  
 +
'''Note: As of WTP 1.5, the classes discussed in this section have not been declared as API and are therefore subject to change.
 +
'''
 
== Validating WSDL Documents with Ant ==
 
== Validating WSDL Documents with Ant ==
  

Revision as of 21:04, 4 June 2006

Contents

WSDL Validation

WTP's WSDL validator validates WSDL 1.1 documents against the WSDL 1.1 specification. Through the Web Services Interoperability (WS-I) extension it can also validate against the WS-I Basic Profile 1.1, Simple SOAP Binding Profile 1.0 and Attachments Profile 1.0.

The WSDL validator, available in all WTP downloads, is located in plug-in org.eclipse.wst.wsdl.validation.

Validating WSDL Documents Programmatically

The WSDL validator can be used programmatically both within and outside of Eclipse.

WSDL validation can be invoked as follows

WSDLValidator validator = new WSDLValidator();
IValidationReport report = validator.validate(URI, INPUTSTREAM, CONFIGURATION);

The URI is actually a URL location representing the location of the document. The WSDL validator won't read from this location if an INPUTSTREAM is provided.
The INPUTSTREAM is an optional inputstream that represents the URI location.
The CONFIGURATION is a WSDLValidationConfiguration, which can be used to pass properties to the validator and extension validators.
The validator returns an IValidationReport that contains validation messages (errors and warnings) produced during validation.

The WSDLValidator also provides the method

public void registerWSDL11Validator(String namespace, WSDL11ValidatorDelegate delegate)

which allows you to register a validator for an extension WSDL 1.1 namespace. Validators for HTTP 1.1 GET and POST and SOAP 1.1 are already provided. When working outside of Eclipse you'll likely want to create a ClassloaderWSDL11ValidatorDelegate as follows:

WSDL11ValidatorDelegate delegate = new ClassloaderWSDL11ValidatorDelegate("org.example.extension.WSDLValidator");

Note: As of WTP 1.5, the classes discussed in this section have not been declared as API and are therefore subject to change.

Validating WSDL Documents with Ant

Validating WSDL Documents from the Command Line