use of org.apache.woden.types.NamespaceDeclaration 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);
}
}
use of org.apache.woden.types.NamespaceDeclaration in project axis-axis2-java-core by apache.
the class WSDL20ToAxisServiceBuilder method setup.
/**
* contains all code which gathers non-wsdlService specific information from the
* wsdl.
* <p/>
* After all the setup completes successfully, the setupComplete field is
* set so that any subsequent calls to setup() will result in a no-op. Note
* that subclass WSDL20ToAllAxisServicesBuilder will call populateService
* for each endpoint in the WSDL. Separating the non-wsdlService specific
* information here allows WSDL20ToAllAxisServicesBuilder to only do this
* work 1 time per WSDL, instead of for each endpoint on each wsdlService.
*
* @throws AxisFault - Thrown in case the necessary resources are not available in the WSDL
* @throws WSDLException - Thrown in case Woden throws an exception
*/
protected void setup() throws AxisFault, WSDLException {
if (setupComplete) {
// already setup, just do nothing and return
return;
}
try {
if (description == null) {
Description description;
DescriptionElement descriptionElement;
if (wsdlURI != null && !"".equals(wsdlURI)) {
description = readInTheWSDLFile(wsdlURI);
descriptionElement = description.toElement();
} else if (in != null) {
description = readInTheWSDLFile(in);
descriptionElement = description.toElement();
} else {
throw new AxisFault("No resources found to read the wsdl");
}
savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
namespacemap = descriptionElement.getDeclaredNamespaces();
this.description = description;
}
// Create the namespacemap
stringBasedNamespaceMap = new NamespaceMap();
for (int i = 0; i < namespacemap.length; i++) {
NamespaceDeclaration namespaceDeclaration = namespacemap[i];
stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(), namespaceDeclaration.getNamespaceURI().toString());
}
DescriptionElement descriptionElement = description.toElement();
createNamespaceMap(descriptionElement);
setupComplete = true;
} catch (AxisFault e) {
// just rethrow AxisFaults
throw e;
} catch (WSDLException e) {
// Preserve the WSDLException
throw e;
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
Aggregations