com.sun.xml.ws.db.DatabindingImpl rt = (com.sun.xml.ws.db.DatabindingImpl) fac.createRuntime(config);
final File[] wsdlFileName = new File[1]; // used to capture the generated WSDL file.
final Map<String, File> schemaFiles = new HashMap<String, File>();
WSDLGenInfo wsdlGenInfo = new WSDLGenInfo();
wsdlGenInfo.setSecureXmlProcessingDisabled(disableXmlSecurity);
wsdlGenInfo.setWsdlResolver(
new WSDLResolver() {
private File toFile(String suggestedFilename) {
return new File(options.nonclassDestDir, suggestedFilename);
}
private Result toResult(File file) {
Result result;
try {
result = new StreamResult(new FileOutputStream(file));
result.setSystemId(file.getPath().replace('\\', '/'));
} catch (FileNotFoundException e) {
errReceiver.error(e);
return null;
}
return result;
}
@Override
public Result getWSDL(String suggestedFilename) {
File f = toFile(suggestedFilename);
wsdlFileName[0] = f;
return toResult(f);
}
public Result getSchemaOutput(String namespace, String suggestedFilename) {
if (namespace == null)
return null;
File f = toFile(suggestedFilename);
schemaFiles.put(namespace, f);
return toResult(f);
}
@Override
public Result getAbstractWSDL(Holder<String> filename) {
return toResult(toFile(filename.value));
}
@Override
public Result getSchemaOutput(String namespace, Holder<String> filename) {
return getSchemaOutput(namespace, filename.value);
}
// TODO pass correct impl's class name
});
wsdlGenInfo.setContainer(container);
wsdlGenInfo.setExtensions(ServiceFinder.find(WSDLGeneratorExtension.class).toArray());
wsdlGenInfo.setInlineSchemas(options.inlineSchemas);
rt.generateWSDL(wsdlGenInfo);
if (options.wsgenReport != null)
generateWsgenReport(endpointClass, (AbstractSEIModelImpl) rt.getModel(), wsdlFileName[0], schemaFiles);