1

我正在使用 jUDDI v3.0.4 客户端来查询 UDDI 服务器(juddi-portal-bundle-3.0.4)。我的兴趣是找到一个服务(我成功了)并查询它的绑定模板,实际上是为了让 Access Point WSDL 能够稍后查询 WebService。

如果我知道 BindingTemplate 密钥,我只能获得接入点,该密钥是通过与 UDDI 服务器一起发布的 Pluto 门户获得的。

当我尝试使用 FindBinding 对象查询服务的 BindingTemplates 时,我得到“javax.xml.ws.soap.SOAPFaultException:必须提供至少一个 categoryBag、find_tModel 或 tModelBag”。但我无法填写 FindBinding 对象中的任何内容。

我错过了什么吗?这不是以后获取服务模板及其 WSDL 的正确方法吗?

谢谢。

奥斯卡。

4

2 回答 2

1

我找到了解决方案。关键是通过业务服务对象来查找绑定模板,这会传递给BindingTemplate对象。

所以,

  1. 通过 UDDIInquiryPortType 提供的 findService(FindService fs) API 查询服务密钥。
  2. 对于返回的 ServiceList,获取包含服务键的 ServiceInfo 对象。
  3. 给定您要查找的服务键(findService 可以通过 Name 对象限定范围),通过 UDDIInquiryPortType 提供的 getServiceDetail(GetServiceDetail sd) API 获取服务详细信息,其中 GetServiceDetail 对象填充了服务键。
  4. 先前查询返回的 ServiceDetail 对象列表将引导您找到包含 Web 服务定义 (WSDL) 的 BindingTemplates。

希望能帮助到你。

于 2011-05-19T14:06:05.553 回答
1

感谢秦玉珠的帮助。代码可以如下:

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);
}
于 2012-09-01T14:34:09.167 回答