程序片段如下,执行到
import java.util.*;
import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;
public class JAXRQuery {
Connection connection = null;
public JAXRQuery() {}
public static void main(String[] args) {
String queryURL =
"http://127.0.0.1:8080/registry-server/RegistryServerServlet";
String publishURL =
"http://127.0.0.1:8080/registry-server/RegistryServerServlet";
String queryString = "Coffee";
System.out.println("Query string is " + queryString);
JAXRQuery jq = new JAXRQuery();
jq.makeConnection(queryURL, publishURL);
jq.executeQuery(queryString);
}
public void makeConnection(String queryUrl, String publishUrl) {
String httpProxyHost = "";
String httpProxyPort = "";
Properties props = new Properties();
props.setProperty("javax.xml.registry.queryManagerURL", queryUrl);
props.setProperty("javax.xml.registry.factoryClass", "com.sun.xml.registry.uddi.ConnectionFactoryImpl");
props.setProperty("javax.xml.registry.http.proxyHost", httpProxyHost);
props.setProperty("javax.xml.registry.http.proxyPort", httpProxyPort);
try {
// Create the connection, passing it the
// configuration properties
ConnectionFactory factory = ConnectionFactory.newInstance();
factory.setProperties(props);
connection = factory.createConnection();
System.out.println("Created connection to registry");
}
catch (Exception e) {
e.printStackTrace();
if (connection != null) {
try {
connection.close();
}
catch (JAXRException je) {}
}
}
}
public void executeQuery(String qString) {
RegistryService rs = null;
BusinessQueryManager bqm = null;
try {
// Get registry service and query manager
rs = connection.getRegistryService();
bqm = rs.getBusinessQueryManager();
System.out.println("Got registry service and query manager");
// Define find qualifiers and name patterns
Collection findQualifiers = new ArrayList();
findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
Collection namePatterns = new ArrayList();
namePatterns.add("%" + qString + "%");
// Find using the name
BulkResponse response =
bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null);
Collection orgs = response.getCollection();
……(以下省略)
可以确定在Xindice数据库内已经存在该org的记录,但是执行到这里orgs的记录数为0,请高手指点
【 在 JoyJava (阳光咖啡) 的大作中提到: 】
: your code snippet
--
FROM 218.19.60.9