endpointClass = classLoader.loadClass(endpoint);
} catch (ClassNotFoundException e) {
throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoint));
}
BindingID bindingID = options.getBindingID(options.protocol);
if (!options.protocolSet) {
bindingID = BindingID.parse(endpointClass);
}
WebServiceFeatureList wsfeatures = new WebServiceFeatureList(endpointClass);
RuntimeModeler rtModeler = new RuntimeModeler(endpointClass, options.serviceName, bindingID, wsfeatures.toArray());
rtModeler.setClassLoader(classLoader);
if (options.portName != null)
rtModeler.setPortName(options.portName);
AbstractSEIModelImpl rtModel = rtModeler.buildRuntimeModel();
final File[] wsdlFileName = new File[1]; // used to capture the generated WSDL file.
final Map<String,File> schemaFiles = new HashMap<String,File>();
WSDLGenerator wsdlGenerator = new WSDLGenerator(rtModel,
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;
}
public Result getWSDL(String suggestedFilename) {
File f = toFile(suggestedFilename);
wsdlFileName[0] = f;
return toResult(f);
}
public Result getSchemaOutput(String namespace, String suggestedFilename) {
if (namespace.equals(""))
return null;
File f = toFile(suggestedFilename);
schemaFiles.put(namespace,f);
return toResult(f);
}
public Result getAbstractWSDL(Holder<String> filename) {
return toResult(toFile(filename.value));
}
public Result getSchemaOutput(String namespace, Holder<String> filename) {
return getSchemaOutput(namespace, filename.value);
}
// TODO pass correct impl's class name
}, bindingID.createBinding(wsfeatures.toArray()), container, endpointClass, ServiceFinder.find(WSDLGeneratorExtension.class).toArray());
wsdlGenerator.doGeneration();
if(options.wsgenReport!=null)
generateWsgenReport(endpointClass,rtModel,wsdlFileName[0],schemaFiles);
}