private javax.wsdl.Message findMessage(QName qn, Definition def, List<Definition> done) { javax.wsdl.Message msg = def.getMessage(qn); if (msg == null) { if (done.contains(def)) { return null; } done.add(def); Collection<List<Import>> ilist = CastUtils.cast(def.getImports().values()); for (List<Import> list : ilist) { for (Import i : list) { if (qn.getNamespaceURI().equals(i.getDefinition().getTargetNamespace())) { return i.getDefinition().getMessage(qn); } } } for (List<Import> list : ilist) { for (Import i : list) { msg = findMessage(qn, i.getDefinition(), done); if (msg != null) { return msg; } } } } return msg; }
private void parseImports(Definition def) { for (Import impt : getImports(def)) { if (!importedDefinitions.contains(impt.getDefinition())) { importedDefinitions.add(impt.getDefinition()); parseImports(impt.getDefinition()); } } }
protected void updateDefinition( Definition def, Map<String, Definition> done, Map<String, SchemaReference> doneSchemas, String base, EndpointInfo ei) { OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus); Collection<List<?>> imports = CastUtils.cast((Collection<?>) def.getImports().values()); for (List<?> lst : imports) { List<Import> impLst = CastUtils.cast(lst); for (Import imp : impLst) { String start = imp.getLocationURI(); String decodedStart = null; // Always use the URL decoded version to ensure that we have a // canonical representation of the import URL for lookup. try { decodedStart = URLDecoder.decode(start, "utf-8"); } catch (UnsupportedEncodingException e) { throw new WSDLQueryException( new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL", LOG, start), e); } String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base); if (resolvedSchemaLocation == null) { try { // check to see if it's already in a URL format. If so, leave it. new URL(start); } catch (MalformedURLException e) { if (done.put(decodedStart, imp.getDefinition()) == null) { updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei); } } } else { if (done.put(decodedStart, imp.getDefinition()) == null) { done.put(resolvedSchemaLocation, imp.getDefinition()); updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei); } } } } /* This doesn't actually work. Setting setSchemaLocationURI on the import * for some reason doesn't actually result in the new URI being written * */ Types types = def.getTypes(); if (types != null) { for (ExtensibilityElement el : CastUtils.cast(types.getExtensibilityElements(), ExtensibilityElement.class)) { if (el instanceof Schema) { Schema see = (Schema) el; updateSchemaImports(see, doneSchemas, base); } } } }