[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.wsvt] Re: WSVT without Eclipse

Hi,

I worked out something that seems to work, including the loading of necessary schemas (there was a small bug a registered in Bugzilla though). Here is the piece of code:

XMLCatalog.addSchemaDir("file:///C:/temp/schemas");
XMLCatalog.getInstance(); // Force loading WSDLValidatorDelegate delegate = new WSDLValidatorDelegate(
"org.eclipse.wsdl.validate.wsdl11.internal.WSDL11ValidatorController", "validatewsdl");
WSDL11ValidatorDelegate delegate11 = new WSDL11ValidatorDelegate(
"org.eclipse.wsdl.validate.wsdl11.internal.WSDL11BasicValidator", "validatewsdl");


ValidatorRegistry.getInstance().registerValidator("http://schemas.xmlsoap.org/wsdl/";, delegate
, ValidatorRegistry.WSDL_VALIDATOR);
org.eclipse.wsdl.validate.wsdl11.internal.ValidatorRegistry.getInstance().registerValidator(
"http://schemas.xmlsoap.org/wsdl/";, delegate11);


org.eclipse.wsdl.validate.WSDLValidator validator = org.eclipse.wsdl.validate.WSDLValidator.getInstance();
ValidationReport report = validator.validate(wsdlDoc);
for (int m = 0; m < report.getValidationMessages().length; m++) {
ValidationMessage validationMessage = report.getValidationMessages()[m];
System.out.println("ERROR : " + validationMessage.getMessage()
+ " at line " + validationMessage.getLine());
}


I was wondering if I really had to register the two validators manually? Is there a way to do this using a property file or something that would get loaded at startup?

Thanks a lot for your help and your hard work, WSVT is working pretty well.

Matthieu.






Lawrence Mandel wrote:

Hi,

If you work with the latest WSDL validator in CVS (extract and build it yourself) you can easily do what you want as follows.

WSDLValidator validator = WSDLValidator.getInstance();
ValidationReport valreport = validator.validate(fileuri);

The validation report contains validation information such as error and warning messages.


Lawrence

Hi,

I would like to use WSVT to validate WSDL documents directly in a java
program. So I don't want to use it using Eclipse nor the Ant task, I'd
like to use the validator API.

Is there an example or something that can help me somewhere? I started
from the Ant task but it's using many Ant constructs that I can't use in
my situation. I'll probably be able to find a way around this but I was
wondering if someone didn't do already the same thing.

Thanks.