You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@juddi.apache.org by Fr...@alcatel.fr on 2004/09/14 17:39:03 UTC
findservice by categorybag with logical AND on two keys
Hi,
I'm a new user of jUDDI and the jUDDI mailing list. I hope my problem
has not been already discussed (I haven't found an exactly similar
situation) or that I haven't misunderstood the UDDI concepts.
Here is my problem : I record 3 services in jUDDI and I categorize them
through Categorybags and two KeyedReferences. The KeyedReferences names
are "param1" and "param2", and their respective possible values are
"net1"/"net2" and "enabled"/"disabled". The three services are as follows :
The saved Service : HelloWorld_1
The ServiceKey : 87DD4210-065D-11D9-8210-BDEDD53581D8
parameter identifier : param1 value :net1
parameter identifier : param2 value :enabled
The saved Service : HelloWorld_2
The ServiceKey : 87FE85B0-065D-11D9-85B0-BD3F75CD791F
parameter identifier : param1 value :net2
parameter identifier : param2 value :enabled
The saved Service : HelloWorld_3
The ServiceKey : 88119880-065D-11D9-9880-E16130BA2D5E
parameter identifier : param1 value :net2
parameter identifier : param2 value :disabled
Then I try to find all services with particular values for param1 and
param2, I'm particularly interested in queries with logical AND. For
example services with param1=net1 AND param2=enabled. In such case, the
problem is that the included services in the response are :
Search results :
Name of Service : HelloWorld_1
Service key : 87DD4210-065D-11D9-8210-BDEDD53581D8
parameter identifier : param1 value :net1
parameter identifier : param2 value :enabled
Name of Service : HelloWorld_2
Service key : 87FE85B0-065D-11D9-85B0-BD3F75CD791F
parameter identifier : param1 value :net2
parameter identifier : param2 value :enabled
It seems that the query is a logical OR (I tried param1=net2 AND
param2=enabled and I got the 3 services). If I correctly read the UDDI
v2 and v3 specifications, and the UDDI4J javadoc concerning the
findservice operation, a logical AND should be used... and I tried the
"AndAllkeys" parameter but it does not work as well.
Here is my source code for that query :
* Building the categorybag for searching
// save searchbag
CategoryBag searchBag = new CategoryBag();
// param1.setKeyValue("net1");
// param2.setKeyValue("disabled");
KeyedReference params1 = new KeyedReference("param1", "net1");
params1.setTModelKey("uddi:uddi-org:general_keywords");
KeyedReference params2 = new KeyedReference("param2", "enabled");
params2.setTModelKey("uddi:uddi-org:general_keywords");
vect.clear();
vect.addElement(params1);
vect.addElement(params2);
searchBag.setKeyedReferenceVector(vect);
System.out.println("\nSearch results:");
helloQuery.hellosearch(proxyInfo, searchBag, businessKey);
* Interesting code in the hellosearch procedure:
// creating vector of Name Object
Vector names = new Vector();
names.add(new Name("Hello"));
FindQualifiers findQualifiers = new FindQualifiers();
Vector qualifier = new Vector();
qualifier.add(new FindQualifier(""));
findQualifiers.setFindQualifierVector(qualifier);
// **** Find the Business Service saved.
// And setting the maximum rows to be returned as 5.
ServiceList serviceList = proxy.find_service(businessKey, names,
searchBag, null, findQualifiers, 5);
// Process the returned ServiceList object
Vector serviceInfoVector = serviceList.getServiceInfos()
.getServiceInfoVector();
for (int i = 0; i < serviceInfoVector.size(); i++) {
ServiceInfo serviceInfo = (ServiceInfo) serviceInfoVector
.elementAt(i);
// Print name for each service
System.out.println("\nName of Service : "
+ serviceInfo.getDefaultNameString());
System.out.println("Service key : "
+ serviceInfo.getServiceKey());
ServiceDetail serviceDet =
proxy.get_serviceDetail(serviceInfo
.getServiceKey());
BusinessService service = (BusinessService) serviceDet
.getBusinessServiceVector().get(0);
try {
CategoryBag bag = service.getCategoryBag();
Vector paramBag = bag.getKeyedReferenceVector();
for (Iterator iter = paramBag.iterator();
iter.hasNext();) {
KeyedReference element = (KeyedReference)
iter.next();
System.out.println("parameter identifier : "
+ element.getKeyName() + " value :"
+ element.getKeyValue());
}
} catch (NullPointerException e) {
// TODO: handle exception
System.out.println("no Categorybag");
}
}
I'm using :
apache tomcat 5.0.27
apache axis 1.2beta3
apache jUDDI 0.9rc3
HSQLDB 1.7.2.2
IBM UDDI4J
Thank you in advance
Franck WIELGUS