Service serv,
QName endpointName,
DescriptionInfo d) {
Map<QName, ServiceInfo> services = new LinkedHashMap<QName, ServiceInfo>();
DescriptionInfo description = d;
if (null == description) {
description = new DescriptionInfo();
if (recordOriginal) {
description.setProperty(WSDL_DEFINITION, def);
}
description.setName(def.getQName());
description.setBaseURI(def.getDocumentBaseURI());
copyExtensors(description, def.getExtensibilityElements());
copyExtensionAttributes(description, def);
Set<Definition> done = new HashSet<Definition>();
done.add(def);
Collection<List<Import>> values = CastUtils.cast(def.getImports().values());
for (List<Import> imports : values) {
for (Import imp : imports) {
if (!done.contains(imp.getDefinition())) {
done.add(imp.getDefinition());
copyExtensors(description, imp.getExtensibilityElements());
copyExtensionAttributes(description, imp);
copyExtensors(description, imp.getDefinition().getExtensibilityElements());
copyExtensionAttributes(description, imp.getDefinition());
}
}
}
}
for (Port port : cast(serv.getPorts().values(), Port.class)) {
if (endpointName != null
&& !endpointName.getLocalPart().equals(port.getName())) {
continue;
}
Binding binding = port.getBinding();
PortType bindingPt = binding.getPortType();
if (bindingPt == null) {
org.apache.cxf.common.i18n.Message msg = new
org.apache.cxf.common.i18n.Message("BINDING_MISSING_TYPE",
LOG,
binding.getQName());
throw new WSDLRuntimeException(msg);
}
//TODO: wsdl4j's bug. if there is recursive import,
//wsdl4j can not get operation input message
PortType pt = def.getPortType(bindingPt.getQName());
if (pt == null) {
pt = bindingPt;
}
ServiceInfo service = services.get(pt.getQName());
if (service == null) {
service = new ServiceInfo();
service.setDescription(description);
description.getDescribed().add(service);
if (recordOriginal) {
service.setProperty(WSDL_DEFINITION, def);
service.setProperty(WSDL_SERVICE, serv);
}
getSchemas(def, service);