Apache jUDDI: Finding Templates

五迷三道 提交于 2019-12-24 10:13:07

问题


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.


回答1:


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,

  1. query for service keys via findService(FindService fs) API offered by UDDIInquiryPortType.
  2. for the ServiceList returned, obtain the ServiceInfo objects which contain the service keys.
  3. 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.
  4. 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.




回答2:


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);
}


来源:https://stackoverflow.com/questions/5991920/apache-juddi-finding-templates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!