int offset = 0;
FindService fb = new FindService();
fb.setMaxRows(fetch);
fb.setListHead(offset);
fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
fb.setFindQualifiers(new FindQualifiers());
fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
ServiceList findService = inquiry.findService(fb);
int returnedcount = findService.getServiceInfos().getServiceInfo().size();
do {
for (int i = 0; i < findService.getServiceInfos().getServiceInfo().size(); i++) {
GetServiceDetail gsd = new GetServiceDetail();
gsd.getServiceKey().add(findService.getServiceInfos().getServiceInfo().get(i).getServiceKey());
ServiceDetail serviceDetail = inquiry.getServiceDetail(gsd);
if (serviceDetail.getBusinessService().get(0).getBindingTemplates() != null
&& !serviceDetail.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().isEmpty()) {
return serviceDetail.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0);
}
}
offset = fetch;
fetch = fetch + 10;
fb = new FindService();
fb.setMaxRows(fetch);
fb.setListHead(offset);
fb.getName().add(new Name(UDDIConstants.WILDCARD, null));
fb.setFindQualifiers(new FindQualifiers());
fb.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
findService = inquiry.findService(fb);
returnedcount = findService.getServiceInfos().getServiceInfo().size();
} while (returnedcount > 0);