Search in sources :

Example 1 with ImportElement

use of org.apache.woden.wsdl20.xml.ImportElement in project axis-axis2-java-core by apache.

the class WSDL20ToAxisServiceBuilder method createNamespaceMap.

/**
 * recursively drills down to get namespace pairs in nested imported elements
 *
 * @param descriptionElement - a description element from where import elements
 *                             and types can be found
 */
private void createNamespaceMap(DescriptionElement descriptionElement) {
    ImportElement[] importElements = descriptionElement.getImportElements();
    for (int i = 0; i < importElements.length; i++) {
        DescriptionElement descElem = importElements[i].getDescriptionElement();
        NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces();
        for (int j = 0; j < namespaceDeclarations.length; j++) {
            NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j];
            if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) {
                stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString());
            }
        }
        // recursively drill down
        createNamespaceMap(descElem);
    }
}
Also used : ImportElement(org.apache.woden.wsdl20.xml.ImportElement) DescriptionElement(org.apache.woden.wsdl20.xml.DescriptionElement) Endpoint(org.apache.woden.wsdl20.Endpoint) NamespaceDeclaration(org.apache.woden.types.NamespaceDeclaration)

Example 2 with ImportElement

use of org.apache.woden.wsdl20.xml.ImportElement in project axis-axis2-java-core by apache.

the class WSDL20ToAxisServiceBuilder method processTypes.

/**
 * recursively drills down to find all type definitions
 * (XSD schemas) in all imported WSDLs and XSDs
 *
 * @param descriptionElement - a description element from where import elements
 *                             and types can be found
 */
private void processTypes(DescriptionElement descriptionElement) {
    TypesElement typesElement = descriptionElement.getTypesElement();
    if (typesElement != null) {
        Schema[] schemas = typesElement.getSchemas();
        for (int i = 0; i < schemas.length; i++) {
            XmlSchema schemaDefinition = schemas[i].getSchemaDefinition();
            // once asked for schema definitions. But for data binding purposes we can ignore that
            if (schemaDefinition != null && !Constants.URI_2001_SCHEMA_XSD.equals(schemaDefinition.getTargetNamespace())) {
                axisService.addSchema(schemaDefinition);
            }
        }
    }
    ImportElement[] importElements = descriptionElement.getImportElements();
    for (int i = 0; i < importElements.length; i++) {
        DescriptionElement descElem = importElements[i].getDescriptionElement();
        // recursively drill down
        processTypes(descElem);
    }
}
Also used : ImportElement(org.apache.woden.wsdl20.xml.ImportElement) TypesElement(org.apache.woden.wsdl20.xml.TypesElement) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Schema(org.apache.woden.schema.Schema) DescriptionElement(org.apache.woden.wsdl20.xml.DescriptionElement) Endpoint(org.apache.woden.wsdl20.Endpoint)

Aggregations

Endpoint (org.apache.woden.wsdl20.Endpoint)2 DescriptionElement (org.apache.woden.wsdl20.xml.DescriptionElement)2 ImportElement (org.apache.woden.wsdl20.xml.ImportElement)2 Schema (org.apache.woden.schema.Schema)1 NamespaceDeclaration (org.apache.woden.types.NamespaceDeclaration)1 TypesElement (org.apache.woden.wsdl20.xml.TypesElement)1 XmlSchema (org.apache.ws.commons.schema.XmlSchema)1