"). WSDL description may be unusable.");
}
// put service description
try {
SourceTransformer st = new SourceTransformer();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
component.getXFire().generateWSDL(svc.getName(), baos);
Node node = st.toDOMNode(new StreamSource(new ByteArrayInputStream(baos.toByteArray())));
Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, (Document) node);
javax.wsdl.Service service = d.getService(serviceName);
if (service != null) {
if (service.getPorts().values().size() == 1) {
endpointName = ((Port) service.getPorts().values().iterator().next()).getName();
// Check if this is the same as defined in endpoint spec
if (es.getEndpointName() == null) {
es.setEndpointName(endpointName);
} else if (!es.getEndpointName().equals(endpointName)) {
logger.warn("The endpoint name defined in the wsdl (" + endpointName +
") does not match the endpoint name defined in the endpoint spec (" + es.getEndpointName() +
"). WSDL description may be unusable.");
}
}
}
if (es.getEndpointName() == null) {
throw new IllegalArgumentException("endpointName should be provided on the endpointSpec");
}
component.setServiceDescription(es.getServiceName(), es.getEndpointName(), (Document) node);
if (logger.isDebugEnabled()) {
logger.debug("WSDL: " + st.toString(node));
}
} catch (Exception e) {
logger.warn("Could not set endpoint description", e);
}