private void addWSAddressingImport(XmlSchema s) {
boolean alreadyImported = false;
for (Iterator i = s.getIncludes().getIterator(); i.hasNext();) {
java.lang.Object o = i.next();
if (o instanceof XmlSchemaImport) {
XmlSchemaImport schemaImport = (XmlSchemaImport)o;
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();
wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE);
wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
s.getItems().add(wsaImport);
s.getIncludes().add(wsaImport);
}
// Add the addressing namespace to the WSDLs list of namespaces.