private void processSchema(javax.wsdl.extensions.schema.Schema schema, Collection<String> namespaceList) throws Exception { for (Iterator itImp = schema.getImports().values().iterator(); itImp.hasNext();) { Collection imps = (Collection) itImp.next(); for (Iterator itSi = imps.iterator(); itSi.hasNext();) { SchemaImport imp = (SchemaImport) itSi.next(); String namespaceUri = imp.getNamespaceURI(); namespaceList.add(namespaceUri); processSchema(imp.getReferencedSchema(), namespaceList); } } } }
/** * Recursively add all imported schemas as schema resource. * This is necessary when schema import are located in jar files. If they are not added immediately the reference to them is lost. * * @param schema */ protected void addImportedSchemas(Schema schema) throws WSDLException, IOException, TransformerException, TransformerFactoryConfigurationError { for (Object imports : schema.getImports().values()) { for (SchemaImport schemaImport : (Vector<SchemaImport>)imports) { // Prevent duplicate imports if (!importedSchemas.contains(schemaImport.getNamespaceURI())) { importedSchemas.add(schemaImport.getNamespaceURI()); Schema referencedSchema = schemaImport.getReferencedSchema(); if (referencedSchema != null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Source source = new DOMSource(referencedSchema.getElement()); Result result = new StreamResult(bos); TransformerFactory.newInstance().newTransformer().transform(source, result); Resource schemaResource = new ByteArrayResource(bos.toByteArray()); addImportedSchemas(referencedSchema); schemaResources.add(schemaResource); } } } } }
private static Boolean setMtomEnabled(Schema schema) { if (schema != null) { if (hasExpectedContentTypes(schema.getElement())) { return true; } for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) { for (SchemaImport simport : c) { if (setMtomEnabled(simport.getReferencedSchema())) { return true; } } } } return false; }
@SuppressWarnings("unchecked") private void addSchema(Schema schema) { Map<String, List> imports = schema.getImports(); if (imports != null && imports.size() > 0) { Collection<String> importKeys = imports.keySet(); for (String importNamespace : importKeys) { if (!isSchemaParsed(importNamespace + "?file=" + schema.getDocumentBaseURI())) { List<SchemaImport> schemaImports = imports.get(importNamespace); for (SchemaImport schemaImport : schemaImports) { Schema tempImport = schemaImport.getReferencedSchema(); if (tempImport != null && !isSchemaImported(tempImport)) { addSchema(tempImport); } } } } } if (!isSchemaImported(schema)) { schemaList.add(schema); } }
private static Boolean setMtomEnabled(Schema schema) { if (schema != null) { if (hasExpectedContentTypes(schema.getElement())) { return true; } for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) { for (SchemaImport simport : c) { if (setMtomEnabled(simport.getReferencedSchema())) { return true; } } } } return false; }
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
private void mapSchema(Schema schema, String contextPath) { Map schemaImports = schema.getImports(); for (Iterator iter = schemaImports.values().iterator(); iter.hasNext();) { List imps = (List) iter.next(); for (Iterator iterator = imps.iterator(); iterator.hasNext();) { SchemaImport schemaImport = (SchemaImport) iterator.next(); Schema schemaImp = schemaImport.getReferencedSchema(); String schemaLoc = schemaImport.getSchemaLocationURI(); if (schemaLoc != null && schemaImp != null && schemaImp.getElement() != null && !URI.create(schemaLoc).isAbsolute()) { schemaLoc = resolveRelativeURI(contextPath, schemaLoc); addResource(schemaLoc, schemaImp.getElement()); // recursively map imported schemas mapSchema(schemaImp, getURIParent(schemaLoc)); } } } List schemaIncludes = schema.getIncludes(); for (Iterator iter = schemaIncludes.iterator(); iter.hasNext();) { SchemaReference schemaInclude = (SchemaReference) iter.next(); Schema schemaImp = schemaInclude.getReferencedSchema(); String schemaLoc = schemaInclude.getSchemaLocationURI(); if (schemaLoc != null && schemaImp != null && schemaImp.getElement() != null && !URI.create(schemaLoc).isAbsolute()) { schemaLoc = resolveRelativeURI(contextPath, schemaLoc); addResource(schemaLoc, schemaImp.getElement()); // recursively map included schemas mapSchema(schemaImp, getURIParent(schemaLoc)); } } }
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
if (oi instanceof SchemaImport) { SchemaImport imp = ((SchemaImport) oi); Schema importedSchema = imp.getReferencedSchema(); if (importedSchema == null) { continue;
Schema tempImport = schemaImport.getReferencedSchema(); String key = schemaImport.getSchemaLocationURI(); if (importNamespace == null && tempImport != null) {
} catch (MalformedURLException e) { if (doneSchemas.put(decodedStart, imp) == null) { updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base); if (doneSchemas.put(decodedStart, imp) == null) { doneSchemas.put(resolvedSchemaLocation, imp); updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);