public List<ServiceInfo> buildMockServices(Definition d) {
List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
List<Definition> defList = new ArrayList<Definition>();
defList.add(d);
parseImports(d, defList);
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
for (Definition def : defList) {
for (Iterator ite = def.getPortTypes().entrySet().iterator(); ite.hasNext();) {
Entry entry = (Entry)ite.next();
PortType portType = def.getPortType((QName)entry.getKey());
ServiceInfo serviceInfo = this.buildMockService(def, portType);
serviceList.add(serviceInfo);
}
if (def.getPortTypes().size() == 0) {
DescriptionInfo description = new DescriptionInfo();
description.setProperty(WSDL_DEFINITION, def);
description.setName(def.getQName());
description.setBaseURI(def.getDocumentBaseURI());
copyExtensors(description, def.getExtensibilityElements());
copyExtensionAttributes(description, def);
ServiceInfo service = new ServiceInfo();
service.setDescription(description);
service.setProperty(WSDL_DEFINITION, def);
getSchemas(def, service);
if (wsdlManager != null) {
ServiceSchemaInfo serviceSchemaInfo = new ServiceSchemaInfo();
serviceSchemaInfo.setSchemaCollection(service.getXmlSchemaCollection());
serviceSchemaInfo.setSchemaInfoList(service.getSchemas());
wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
}
service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
serviceList.add(service);
}