}
public boolean hasNext() {
if (handler!=null && info!=null) return true;
if (index+1>=descriptors.length) return false;
ServiceDescription desc = descriptors[++index];
String currentSoapUrl = desc.getUrl();
String currentRestUrl = Pattern.compile("\\Q"+getTarget().getSoapUrl()+"\\E", Pattern.CASE_INSENSITIVE).matcher(currentSoapUrl).replaceFirst(getTarget().getRestUrl());
boolean matchesTarget = false;
if (!matchAll) {
matchesTarget = normalizedTargetSoapUrl.equalsIgnoreCase(currentSoapUrl);
if (!matchesTarget && checkFolder) {
matchesTarget = currentSoapUrl.toLowerCase().startsWith(normalizedTargetSoapUrl.toLowerCase()+"/");
}
}
if (!(matchAll || matchesTarget)) return hasNext();
handler = factory.makeHandler(desc.getType());
if (handler==null) return hasNext();
handler.setCredentials(getCredentials());
// get parent description if available for the current description
ServiceDescription parentDesc = childToParent.get(desc);
// get service info for the parent
ServiceInfo parentInfo = sdToSi.get(parentDesc);
// create servcice info for the current service description
info = handler.createServiceInfo(parentInfo, desc, currentRestUrl, currentSoapUrl);