dbf = DocumentBuilderFactory.newInstance();
db = dbf.newDocumentBuilder();
}
Document doc = db.parse(inputStream);
ControllerValidationInfo validateInfo = new ValidationInfoImpl(sourceURL, messagegenerator);
URIResolver uriResolver = new URIResolver();
((ValidationInfoImpl) validateInfo).setURIResolver(uriResolver);
/*java.util.Hashtable attributes = new java.util.Hashtable();
((ValidationInfoImpl) validateInfo).setAttributes(attributes);*/
WSDL11ValidationInfoImpl info = new WSDL11ValidationInfoImpl(validateInfo);
info.setElementLocations(new java.util.Hashtable());
WSDL11BasicValidator validator = new WSDL11BasicValidator();
registerExtensionValidators(validator.getClass().getClassLoader());
IValidationMessage[] messages;
ExtendedWSDL11ValidatorController wsdl11ValidatorController =
new ExtendedWSDL11ValidatorController();
WSDLDocument[] wsdlDocs = wsdl11ValidatorController.readWSDLDocument(doc,
validateInfo.getFileURI(),
messagegenerator,
info);
WSDLDocument document = wsdlDocs[0];
List schema = document.getSchemas();
Iterator xsdIter = schema.iterator();
while (xsdIter.hasNext()) {
info.addSchema((XSModel) xsdIter.next());
}
// Set the element locations table.
info.setElementLocations(document.getElementLocations());
validator.validate(wsdlDefinition, new ArrayList(), info);
messages = validateInfo.getValidationMessages();
WSDLValidationInfo wsdlValidationInfo = new WSDLValidationInfo();
if (messages.length > 0) {
wsdlValidationInfo.setStatus(INVALID);
} else {
wsdlValidationInfo.setStatus(VALID);
}
for (IValidationMessage message : messages) {
String messageString =
"[" + message.getLine() + "][" + message.getColumn() + "]"
+ message.getMessage();
wsdlValidationInfo.addValidationMessage(messageString);
}
if (WSITestToolsPlugin.getPlugin() == null) {
WSITestToolsPlugin.getInstance();
WSITestToolsProperties.setEclipseContext(false);
BaseValidator[] validators = new BaseValidator[4];
ProfileValidatorFactoryImpl factory = new ProfileValidatorFactoryImpl();
validators[0] = factory.newWSDLValidator();
validators[1] = factory.newUDDIValidator();
validators[2] = factory.newEnvelopeValidator();
validators[3] = factory.newMessageValidator();
WSITestToolsPlugin.getPlugin().setBaseValidators(validators);
}
org.eclipse.wst.wsi.internal.validate.wsdl.WSDLValidator wsiValidator =
new org.eclipse.wst.wsi.internal.validate.wsdl.WSDLValidator();
ControllerValidationInfo validationInfo = new ValidationInfoImpl(sourceURL, messagegenerator);
((ValidationInfoImpl) validationInfo).setURIResolver(uriResolver);
WSDLValidationInfo wsiValidationInfo = new WSDLValidationInfo();
wsiValidator.validate(doc, validationInfo);
messages = validationInfo.getValidationMessages();
if (messages.length > 0) {
wsiValidationInfo.setStatus(INVALID);
} else {
wsiValidationInfo.setStatus(VALID);
}