private void addWSAddressingImport(XmlSchema s) {
boolean alreadyImported = false;
for (XmlSchemaExternal ext : s.getExternals()) {
if (ext instanceof XmlSchemaImport) {
XmlSchemaImport schemaImport = (XmlSchemaImport)ext;
if (schemaImport.getNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)) {
alreadyImported = true;
break;
}
}
}
if (!alreadyImported) {
// We need to add an import statement to include the WS addressing types
XmlSchemaImport wsaImport = new XmlSchemaImport(s);
wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE);
wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
}
// Add the addressing namespace to the WSDLs list of namespaces.
definition.addNamespace(ReferenceConstants.WSADDRESSING_PREFIX,
ReferenceConstants.WSADDRESSING_NAMESPACE);