I'm using jUDDI v3.0.4 client to inquiry a UDDI server (juddi-portal-bundle-3.0.4). My interest is to find a service (which I succeeded) and query for its Binding Templates, in fact to get the Access Point WSDL to be able to query the WebService later.
I only can get the Access point if I know the BindingTemplate key, which I get via Pluto portal released with the UDDI Server.
When I try to query for the BindingTemplates of a service, with a FindBinding object, I get "javax.xml.ws.soap.SOAPFaultException: At least one categoryBag, find_tModel or tModelBag must be supplied". But I cannot fill in any of those in the FindBinding object.
Am I missing something?, is that not the correct way of getting a service template and its WSDL later?
Thanks.
Oscar.
I found out the solution.
The key is to look for the binding templates through the business service object, this carries to the BindingTemplate object.
So,
- query for service keys via findService(FindService fs) API offered by UDDIInquiryPortType.
- for the ServiceList returned, obtain the ServiceInfo objects which contain the service keys.
- given the service keys you are looking for (the findService may be scoped via a Name object), obtain the service detail via the getServiceDetail(GetServiceDetail sd) API offered by UDDIInquiryPortType, where the GetServiceDetail object is filled in with the service keys.
- the list of ServiceDetail objects returned by previous query will guide you to the BindingTemplates which contain the web service definition (WSDL).
Hope it helps.
Thanks to 秦玉珠 for the help. The code can be as follows:
ServiceList list1=inquiryService.findService(findservice);
GetServiceDetail gsd=new GetServiceDetail();
for(ServiceInfo serviceInfo :list1.getServiceInfos().getServiceInfo()){
gsd.getServiceKey().add(serviceInfo.getServiceKey());
System.out.println(serviceInfo.getServiceKey());
String servicekey=serviceInfo.getServiceKey();
GetServiceDetail getServiceDetail=new GetServiceDetail();
getServiceDetail.setAuthInfo(authinfo);
getServiceDetail.getServiceKey().add(servicekey);
ServiceDetail serviceDetail=inquiryService.getServiceDetail(getServiceDetail);
BusinessService businessservice=serviceDetail.getBusinessService().get(0);
System.out.println("fetched service name:"+businessservice.getName().get(0).getValue());
String bindingkey = businessservice.getBindingTemplates().getBindingTemplate().get(0).getBindingKey();
System.out.println(bindingkey);
GetBindingDetail gbd = new GetBindingDetail();
gbd.setAuthInfo(authinfo);
gbd.getBindingKey().add(bindingkey);
BindingDetail bindingdetail=inquiryService.getBindingDetail(gbd);
BindingTemplate bindingtemplate=bindingdetail.getBindingTemplate().get(0);
String accesspoint=bindingtemplate.getAccessPoint().getValue();
System.out.println(accesspoint);
}