use of javax.wsdl.extensions.schema.SchemaReference in project cxf by apache.
the class WSDLGetUtils method updateSchemaImports.
protected void updateSchemaImports(Bus bus, Schema schema, String docBase, Map<String, SchemaReference> doneSchemas, String base, String parentResolved) {
Collection<List<?>> imports = CastUtils.cast((Collection<?>) schema.getImports().values());
for (List<?> lst : imports) {
List<SchemaImport> impLst = CastUtils.cast(lst);
for (SchemaImport imp : impLst) {
processSchemaReference(imp, bus, schema, docBase, doneSchemas, base, parentResolved);
}
}
List<SchemaReference> includes = CastUtils.cast(schema.getIncludes());
for (SchemaReference included : includes) {
processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
}
List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
for (SchemaReference included : redefines) {
processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
}
}
use of javax.wsdl.extensions.schema.SchemaReference in project cxf by apache.
the class ServiceWSDLBuilder method buildTypes.
protected void buildTypes(final Collection<SchemaInfo> schemas, final Map<String, SchemaInfo> imports, final Definition def) {
Types types = def.createTypes();
for (SchemaInfo schemaInfo : schemas) {
Schema schemaImpl = getSchemaImplementation(def);
schemaImpl.setRequired(true);
schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl.setElement(schemaInfo.getElement());
for (XmlSchemaExternal ext : schemaInfo.getSchema().getExternals()) {
if (ext.getSchema() == null) {
continue;
}
if (ext instanceof XmlSchemaImport) {
SchemaImport imp = schemaImpl.createImport();
imp.setNamespaceURI(((XmlSchemaImport) ext).getNamespace());
imp.setSchemaLocationURI(((XmlSchemaImport) ext).getSchemaLocation());
Schema schemaImpl2 = getSchemaImplementation(def);
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
// ignore
}
imp.setReferencedSchema(schemaImpl2);
schemaImpl.addImport(imp);
} else if (ext instanceof XmlSchemaInclude) {
SchemaReference imp = schemaImpl.createInclude();
imp.setSchemaLocationURI(((XmlSchemaInclude) ext).getSchemaLocation());
Schema schemaImpl2 = getSchemaImplementation(def);
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
// ignore
}
imp.setReferencedSchema(schemaImpl2);
schemaImpl.addInclude(imp);
} else if (ext instanceof XmlSchemaRedefine) {
SchemaReference imp = schemaImpl.createRedefine();
imp.setSchemaLocationURI(((XmlSchemaRedefine) ext).getSchemaLocation());
Schema schemaImpl2 = getSchemaImplementation(def);
schemaImpl2.setRequired(true);
schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
try {
schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
} catch (XmlSchemaSerializerException e) {
// ignore
}
imp.setReferencedSchema(schemaImpl2);
schemaImpl.addRedefine(imp);
}
}
types.addExtensibilityElement(schemaImpl);
}
def.setTypes(types);
}
Aggregations