import java.util.*;
import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;
public class JaxrQuery {
public static void main( String[] args ) throws Exception {
System.setProperty("http.proxyHost", "192.168.1.1"); // adresse IP
System.setProperty("http.proxyPort", "8080");
String queryString = "test"; //test; business
Connection connection = null;
// Define connection configuration properties
// To query, you need only the query URL
Properties props = new Properties();
props.setProperty(
"javax.xml.registry.queryManagerURL",
//"http://www-3.ibm.com/services/uddi/testregistry/inquiryapi"
"http://uddi.microsoft.com:80/inquire"
);
props.setProperty(
"javax.xml.registry.factoryClass",
"com.sun.xml.registry.uddi.ConnectionFactoryImpl" );
// Create the connection, passing it the configuration properties
ConnectionFactory factory = ConnectionFactory.newInstance();
factory.setProperties( props );
connection = factory.createConnection();
// Get registry service and business query manager
RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
System.out.println( "We have the Business Query Manager" );
// Define find qualifiers and name patterns
Collection findQualifiers = new ArrayList();
findQualifiers.add( FindQualifier.SORT_BY_NAME_ASC );
Collection namePatterns = new ArrayList();
namePatterns.add( "%" + queryString + "%" );
// Find based upon qualifier type and values
System.out.println( "\n-- searching the registry --\n" );
BulkResponse response = bqm.findOrganizations(
findQualifiers, namePatterns, null, null, null, null
);
Diapositive précédente Diapositive suivante
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :