if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(configuration.getWSDLVersion())) {
WSDL20ToAxisServiceBuilder builder;
// jibx currently does not support multiservice
if ((configuration.getServiceName() != null) || (configuration.getDatabindingType().equals("jibx"))) {
builder = new WSDL20ToAxisServiceBuilder(
wsdlUri,
configuration.getServiceName(),
configuration.getPortName(),
configuration.isAllPorts());
builder.setCodegen(true);
configuration.addAxisService(builder.populateService());
} else {
builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, configuration.getPortName());
builder.setCodegen(true);
builder.setAllPorts(configuration.isAllPorts());
configuration.setAxisServices(
((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices());
}
} 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;
// jibx currently does not support multiservice
if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) {
builder = new WSDL11ToAxisServiceBuilder(
wsdl4jDef,
serviceQname,
configuration.getPortName(),
configuration.isAllPorts());
builder.setCodegen(true);
configuration.addAxisService(builder.populateService());
} else {
builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, configuration.getPortName());
builder.setCodegen(true);
builder.setAllPorts(configuration.isAllPorts());
configuration.setAxisServices(
((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices());
}
}
configuration.setBaseURI(getBaseURI(wsdlUri));