use of javax.wsdl.extensions.UnknownExtensibilityElement in project tdi-studio-se by Talend.
the class ComponentBuilder method createSchemaFromTypes.
protected Vector<XmlSchema> createSchemaFromTypes(List<Definition> wsdlDefinitions) throws WSDLException {
Vector<XmlSchema> schemas = new Vector<XmlSchema>();
Set<String> imports = new HashSet<String>();
org.w3c.dom.Element schemaElementt = null;
Map importElement = null;
List includeElement = null;
for (Definition def : wsdlDefinitions) {
if (def.getTypes() != null) {
Vector schemaExtElem = findExtensibilityElement(def.getTypes().getExtensibilityElements(), "schema");
for (int i = 0; i < schemaExtElem.size(); i++) {
ExtensibilityElement schemaElement = (ExtensibilityElement) schemaExtElem.elementAt(i);
if (schemaElement != null && schemaElement instanceof UnknownExtensibilityElement) {
schemaElementt = ((UnknownExtensibilityElement) schemaElement).getElement();
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
if (schema != null) {
schemas.add(schema);
if (schema.getTargetNamespace() != null) {
schemaNames.add(schema.getTargetNamespace());
}
}
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
if (importElement != null && importElement.size() > 0) {
findImportSchema(def, schemas, importElement, imports);
}
}
if (schemaElement != null && schemaElement instanceof javax.wsdl.extensions.schema.Schema) {
schemaElementt = ((javax.wsdl.extensions.schema.Schema) schemaElement).getElement();
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
Boolean isHaveImport = false;
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
if (importElement != null && importElement.size() > 0) {
Iterator keyIterator = importElement.keySet().iterator();
// }
if (importElement.size() > 0) {
isHaveImport = true;
}
// validateImportUrlPath(importElement);
}
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
if (schema != null) {
schemas.add(schema);
if (schema.getTargetNamespace() != null) {
schemaNames.add(schema.getTargetNamespace());
}
}
if (isHaveImport) {
findImportSchema(def, schemas, importElement, imports);
}
}
}
}
}
return schemas;
}
use of javax.wsdl.extensions.UnknownExtensibilityElement in project tomee by apache.
the class CommonsSchemaLoader method addImportsFromDefinition.
private void addImportsFromDefinition(Definition definition) throws OpenEJBException {
Types types = definition.getTypes();
if (types != null) {
for (Object extensibilityElement : types.getExtensibilityElements()) {
if (extensibilityElement instanceof Schema) {
Schema unknownExtensibilityElement = (Schema) extensibilityElement;
QName elementType = unknownExtensibilityElement.getElementType();
if (new QName("http://www.w3.org/2001/XMLSchema", "schema").equals(elementType)) {
Element element = unknownExtensibilityElement.getElement();
xmlSchemaCollection.read(element);
}
} else if (extensibilityElement instanceof UnknownExtensibilityElement) {
//This is allegedly obsolete as of axis-wsdl4j-1.2-RC3.jar which includes the Schema extension above.
//The change notes imply that imported schemas should end up in Schema elements. They don't, so this is still needed.
UnknownExtensibilityElement unknownExtensibilityElement = (UnknownExtensibilityElement) extensibilityElement;
Element element = unknownExtensibilityElement.getElement();
String elementNamespace = element.getNamespaceURI();
String elementLocalName = element.getNodeName();
if ("http://www.w3.org/2001/XMLSchema".equals(elementNamespace) && "schema".equals(elementLocalName)) {
xmlSchemaCollection.read(element);
}
}
}
}
//noinspection unchecked
Map<String, List<Import>> imports = definition.getImports();
if (imports != null) {
for (Map.Entry<String, List<Import>> entry : imports.entrySet()) {
String namespaceURI = entry.getKey();
List<Import> importList = entry.getValue();
for (Import anImport : importList) {
//according to the 1.1 jwsdl mr shcema imports are supposed to show up here,
//but according to the 1.0 spec there is supposed to be no Definition.
Definition importedDef = anImport.getDefinition();
if (importedDef != null) {
addImportsFromDefinition(importedDef);
} else {
log.warn("Missing definition in import for namespace " + namespaceURI);
}
}
}
}
}
Aggregations