Definition def = null;
try {
Writer os = FileWriterUtil.getWriter(file);
WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
ServiceWSDLBuilder builder = new ServiceWSDLBuilder(getBus(), getServiceModel());
builder.setUseSchemaImports(this.allowImports());
String name = file.getName();
if (name.endsWith(".wsdl")) {
name = name.substring(0, name.lastIndexOf(".wsdl"));
}
builder.setBaseFileName(name);
Map<String, SchemaInfo> imports = new HashMap<String, SchemaInfo>();
def = builder.build(imports);
wsdlWriter.writeWSDL(def, os);
os.close();
if (def.getImports().size() > 0) {
for (Import wsdlImport : WSDLDefinitionBuilder.getImports(def)) {