for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) {
Service service = (Service) sIter.next();
QName serviceQname = service.getQName();
for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) {
Port port= (Port) pIter.next();
if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested.
PortType portType= getPortType(port);
if(null == portType) continue; // not connected.
QName pQName= portType.getQName();
if(donePortTypes.contains(pQName)) continue; //allready did it.
donePortTypes.add(pQName);
if (packageName == null) {
packageName = XMLNameUtil.getPackageNameFromNamespace(definition.getTargetNamespace());
}
JavaTypeMapper typeMapper = new JavaTypeMapper();
for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) {
typeMapper.addTypeMappingObject(e.getKey(), e.getValue());
}
AxisService axisService;
try {
axisService = new WSDL2AxisServiceBuilder(definition, serviceQname, port.getName()).populateService();
} catch (AxisFault e) {
throw new CodeGenerationException(e);
}
axisService.setName(port.getBinding().getPortType().getQName().getLocalPart());
CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP);
codegenConfigurations.add(codegenConfiguration);
codegenConfiguration.setAxisService(axisService);
codegenConfiguration.setAdvancedCodeGenEnabled(false);
codegenConfiguration.setAsyncOn(false);
codegenConfiguration.setDatabindingType("sdo");
codegenConfiguration.setGenerateAll(true);
codegenConfiguration.setGenerateDeployementDescriptor(false);
codegenConfiguration.setOutputLanguage("java");
codegenConfiguration.setOutputLocation(new File(outputLocation));
codegenConfiguration.setPackageName(packageName);
codegenConfiguration.setPackClasses(false);
codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP);
codegenConfiguration.setPortName(port.getName());
codegenConfiguration.setServerSide(false);
codegenConfiguration.setServiceName(service.getQName().getLocalPart());
codegenConfiguration.setSyncOn(true);
codegenConfiguration.setTypeMapper(typeMapper);
codegenConfiguration.setWriteMessageReceiver(false);