configuration = new CodeGenConfiguration(allOptions);
if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(configuration.getWSDLVersion())) {
WSDL20ToAxisServiceBuilder builder = new WSDL20ToAxisServiceBuilder(wsdlUri,
configuration.getServiceName(),
configuration.getPortName());
builder.setCodegen(true);
configuration.addAxisService(builder.populateService());
} else {
//It'll be WSDL 1.1
Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
// we save the original wsdl definition to write it to the resource folder later
// this is required only if it has imports
Map imports = wsdl4jDef.getImports();
if ((imports != null) && (imports.size() > 0)) {
configuration.setWsdlDefinition(readInTheWSDLFile(wsdlUri));
} else {
configuration.setWsdlDefinition(wsdl4jDef);
}
// we generate the code for one service and one port if the
// user has specified them.
// otherwise generate the code for every service.
// TODO: find out a permanant solution for this.
QName serviceQname = null;
if (configuration.getServiceName() != null) {
serviceQname = new QName(wsdl4jDef.getTargetNamespace(),
configuration.getServiceName());
}
WSDL11ToAxisServiceBuilder builder = null;
// jibx currently does not support multiservice
if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) {
builder = new WSDL11ToAxisServiceBuilder(
wsdl4jDef,
serviceQname,
configuration.getPortName());
builder.setCodegen(true);
configuration.addAxisService(builder.populateService());
} else {
builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef);
builder.setCodegen(true);
configuration.setAxisServices(
((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices());
}
}