Author: alessio.soldano(a)jboss.com
Date: 2009-10-12 12:59:37 -0400 (Mon, 12 Oct 2009)
New Revision: 10894
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
Log:
[JBWS-2784] Fix
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2009-10-12
15:37:25 UTC (rev 10893)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2009-10-12
16:59:37 UTC (rev 10894)
@@ -378,10 +378,13 @@
String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
// search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifyPortAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices());
+ if (modifyPortAddress(tnsURI, portQName, serviceEndpointURL,
wsdlOneOneDefinition.getServices()))
+ {
+ return;
+ }
- // recursivly process imports if none can be found
- if (wsdlOneOnePort == null &&
!wsdlOneOneDefinition.getImports().isEmpty())
+ // recursively process imports if none can be found
+ if (!wsdlOneOneDefinition.getImports().isEmpty())
{
Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
@@ -392,19 +395,28 @@
while (importsByNS.hasNext())
{
Import anImport = (Import)importsByNS.next();
- wsdlOneOnePort = modifyPortAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices());
+ if (modifyPortAddress(anImport.getNamespaceURI(), portQName,
serviceEndpointURL, anImport.getDefinition().getServices()))
+ {
+ return;
+ }
}
}
}
-
- // if it still doesn't exist something is wrong
- if (wsdlOneOnePort == null)
- throw new IllegalArgumentException("Cannot find port with name '"
+ portQName + "' in wsdl document");
+
+ throw new IllegalArgumentException("Cannot find port with name '" +
portQName + "' in wsdl document");
}
- private static Port modifyPortAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
+ /**
+ * Try matching the port and modify it. Return true if the port is actually matched.
+ *
+ * @param tnsURI
+ * @param portQName
+ * @param serviceEndpointURL
+ * @param services
+ * @return
+ */
+ private static boolean modifyPortAddress(String tnsURI, QName portQName, String
serviceEndpointURL, Map services)
{
- Port wsdlOneOnePort = null;
Iterator itServices = services.values().iterator();
while (itServices.hasNext())
{
@@ -416,7 +428,7 @@
String portLocalName = (String)itPorts.next();
if (portQName.equals(new QName(tnsURI, portLocalName)))
{
- wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
+ Port wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
List extElements = wsdlOneOnePort.getExtensibilityElements();
for (Object extElement : extElements)
{
@@ -436,11 +448,11 @@
address.setLocationURI(serviceEndpointURL);
}
}
+ return true;
}
}
}
-
- return wsdlOneOnePort;
+ return false;
}
private static String getUriScheme(String addrStr)
Show replies by date