// start with the service
Map services = wsdlDescription.getServices();
if ((services != null) && !services.isEmpty()) {
WSDLService selectedService;
WSDLEndpoint selectedEndpoint;
if (services.size() > 1) {
// look for the users setting here
if (configuration.getServiceName() != null) {
selectedService = wsdlDescription.getService(new QName(configuration.getWom().getTargetNameSpace(),
configuration.getServiceName()));
if (selectedService == null) {
throw new RuntimeException(CodegenMessages.getMessage("emitter.serviceNotFoundError",
configuration.getServiceName()));
}
} else {
// print warning
System.out.println(CodegenMessages.getMessage("emitter.warningMultipleServices"));
// note - we are sure of no NPE's here
selectedService = (WSDLService) services.values().iterator().next();
}
} else {
// note - we are sure of no NPE's here
selectedService = (WSDLService) services.values().iterator().next();
}
infoHolder.setService(selectedService);
// get the ports from the service
Map endpoints = selectedService.getEndpoints();
if ((endpoints != null) && !endpoints.isEmpty()) {
if (endpoints.size() > 1) {
// look for the users setting here
if (configuration.getPortName() != null) {
selectedEndpoint =
selectedService.getEndpoint(new QName(configuration.getWom().getTargetNameSpace(),
configuration.getPortName()));
if (selectedEndpoint == null) {
throw new RuntimeException(CodegenMessages.getMessage("emitter.endpointNotFoundError"));
}