try {
for (int i = 0; i < scopes.length; i++) {
uriScopes[i] = new URI(scopes[i]);
}
DiscoveryClient discoveryClient = new DiscoveryClient(messageContext.getConfigurationContext(), discoveryProxy);
TargetService[] targetServices = discoveryClient.probe(types, uriScopes);
if ((targetServices != null) && (targetServices.length > 0)) {
// currently we try to use the first one.
URI targetURI = null;
if ((targetServices[0].getXAddresses() != null) && (targetServices[0].getXAddresses().length > 0)) {