private void validateWsdl1(JmsSoapConsumerMarshaler marshaler) throws WSDLException, IOException, DeploymentException {
Definition def = WSDLUtils.createWSDL11Reader().readWSDL(wsdl.getURL().toString());
if (validateWsdl) {
WSIBPValidator validator = new WSIBPValidator(def);
if (!validator.isValid()) {
throw new DeploymentException("WSDL is not WS-I BP compliant: " + validator.getErrors());
}
}
Service svc;
if (getService() != null) {
svc = def.getService(getService());
if (svc == null) {
throw new DeploymentException("Could not find service '" + getService() + "' in wsdl");
}
} else if (def.getServices().size() == 1) {
svc = (Service) def.getServices().values().iterator().next();
setService(svc.getQName());
} else {
throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
}
Port port;
if (getEndpoint() != null) {
port = svc.getPort(getEndpoint());
if (port == null) {
throw new DeploymentException(
"Could not find port '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
}
} else if (svc.getPorts().size() == 1) {
port = (Port) svc.getPorts().values().iterator().next();
setEndpoint(port.getName());
} else {
throw new DeploymentException(
"If endpoint is not set, the WSDL service '" + getService() + "' must contain a single port definition");
}
SOAPAddress soapAddress = WSDLUtils.getExtension(port, SOAPAddress.class);
if (soapAddress != null) {
soapAddress.setLocationURI(getLocationURI());