List importList = (List)importListIterator.next();
Iterator importIterator = importList.iterator();
while (importIterator.hasNext())
{
Import _import = (Import)importIterator.next();
Definition importedDef = _import.getDefinition();
//String importedNamespace = _import.getNamespaceURI();
String importedDefTNS = null;
if (importedDef != null)
{
importedDefTNS = importedDef.getTargetNamespace();
/*
Since an imported definition was actually resolved, we have to make
sure that a targetNamespace was specified, and that it matches the
value of the namespace attribute specified on the <import> element.
*/
if (importedDefTNS == null || importedDefTNS.equals(""))
{
throw new IllegalArgumentException("You cannot <import> WSDL v1.1 " +
"documents that do not " +
"specify the targetNamespace " +
"attribute on the definition " +
"element.");
}
else if (!importedDefTNS.equals(_import.getNamespaceURI()))
{
throw new IllegalArgumentException("The value of the namespace " +
"attribute on the <import> " +
"element must match the " +
"value of the targetNamespace " +
"attribute specified on the " +
"document being imported.");
}
}
else
{
/*
Since no definition was resolved, use the value from the namespace
attribute on the <import> element.
*/
importedDefTNS = _import.getNamespaceURI();
if (importedDefTNS == null || importedDefTNS.equals(""))
{
throw new IllegalArgumentException("You cannot <import> WSDL v1.1 " +
"documents wihout either " +
"specifying the targetNamespace " +
"attribute on the imported " +
"definition element or " +
"specifying the namespace " +
"attribute on the <import> " +
"element.");
}
}
// Determine whether the -targetNS value should be propagated.
if (newTargetNS != null && !newTargetNS.equals(""))
{
if (importedDefTNS.equals(origTargetNamespace))
{
importedDefTNS = newTargetNS;
}
else if (!importedDefTNS.equals(newTargetNS))
{
newTargetNS = null;
}
}
String targetFileName = null;
String locationURI = _import.getLocationURI();
if (locationURI != null
&& !locationURI.equals("")
&& importedDef != null)
{