package publish;
import java.util.ArrayList;
import java.util.Vector;
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.datatype.Name;
import org.uddi4j.datatype.binding.AccessPoint;
import org.uddi4j.datatype.binding.BindingTemplate;
import org.uddi4j.datatype.service.BusinessService;
import org.uddi4j.response.BusinessInfo;
import org.uddi4j.response.BusinessList;
import org.uddi4j.response.ServiceDetail;
import org.uddi4j.response.ServiceInfo;
import org.uddi4j.response.ServiceList;
import org.uddi4j.response.TModelInfo;
import org.uddi4j.response.TModelList;
import org.uddi4j.transport.TransportException;
import org.uddi4j.util.CategoryBag;
import org.uddi4j.util.FindQualifier;
import org.uddi4j.util.FindQualifiers;
import org.uddi4j.util.KeyedReference;
import org.uddi4j.util.TModelBag;
import org.uddi4j.util.TModelKey;
public class find_weather_information {
public static void main(String[] args) throws TransportException, Exception{
find_weather_information find = new find_weather_information();
ArrayList rs= new ArrayList();
rs=find.find_URL();
for(int i=0;i <rs.size();i++){
System.out.println(rs.get(i));
}
}
public ArrayList find_URL() throws Exception, TransportException
{
String inquiryURL = "http://localhost:8080/juddi/inquiry";
String publishURL= "http://localhost:8080/juddi/publish";
String userid="juddi";
String password="juddi";
// 创建一个 UDDIProxy object.
UDDIProxy proxy = new UDDIProxy();
// 设置环境
proxy.setInquiryURL(inquiryURL);
proxy.setPublishURL(publishURL);
//tModel的查询
//根据TModel的categoryBag查询,目标是categoryBag的name为uddi-org:types,值为wsdlSpec的tModel
CategoryBag categoryBag = new CategoryBag();
categoryBag.add(new KeyedReference("uddi-org:types", "wsdlSpec"));
TModelList tModelList=proxy.find_tModel(null,categoryBag, null, null, 0);
//讲找到的tModelkey放入ArrayList中
String tModelKey = null;
ArrayList tModelKeyList=new ArrayList();
Vector tModelInfoVector =tModelList.getTModelInfos().getTModelInfoVector();
for(int i=0;i <tModelInfoVector.size();i++)
{
tModelKey = ((TModelInfo)tModelInfoVector.get(i)).getTModelKey();
tModelInfoVector.add(tModelKey);
}
//创建TModelBag,存放上面找到的符合要求的TModel,便于下面的查询使用
TModelBag tModelBag = new TModelBag();
for(int i=0;i <tModelKeyList.size();i++)
tModelBag.add((TModelKey) tModelKeyList.get(i));
//Entity的查询
//填名字
Vector entity_names = new Vector();
entity_names.add(new Name("%Airlines_Company%"));记得加“%”
//设置FindQualifiers为“区分大小写模式”
FindQualifiers findQualifiers = new FindQualifiers();
Vector qualifier = new Vector();
qualifier.add(new FindQualifier("caseSensitiveMatch"));//区分大小写匹配模式
findQualifiers.setFindQualifierVector(qualifier);
//查找
BusinessList businessList = proxy.find_business(entity_names, null, null, null,tModelBag,findQualifiers,0);
//对每个Entity查询service
String businessKey= null;
String serviceKey= null;
ServiceDetail serviceDetail = null;
BindingTemplate bindingTemplate = null;
AccessPoint accessPoint = null;
ArrayList URLlist=new ArrayList();
Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector();
for( int i = 0; i < businessInfoVector.size(); i++ )
{
//Service查询
//获得BusinessKey
BusinessInfo businessInfo = (BusinessInfo)businessInfoVector.elementAt(i);
businessKey=businessInfo.getBusinessKey();
//填名字
Vector service_names = new Vector();
service_names.add(new Name("%inquiry_service%"));
//设置FindQualifiers为“区分大小写模式”,直接用上面的就好
//查询service
ServiceList serviceList = proxy.find_service(businessKey,service_names,
null,tModelBag,findQualifiers,0);
//对每个service获得URL
Vector serviceInfoVector = serviceList.getServiceInfos().getServiceInfoVector();
for( int j = 0; j < serviceInfoVector.size(); j++ )
{
//获得serviceKey
ServiceInfo serviceInfo = (ServiceInfo)serviceInfoVector.elementAt(j);
serviceKey=serviceInfo.getServiceKey();
//使用serviceDetail对象,找到其中的BindingTemplate,再从BindingTemplate中找到AccessPoint
serviceDetail = proxy.get_serviceDetail(serviceKey);
Vector businessServiceVector = serviceDetail.getBusinessServiceVector();
BusinessService businessService =(BusinessService) businessServiceVector.get(0);
Vector bindingTemplateVector=businessService.getBindingTemplates().getBindingTemplateVector();
bindingTemplate = (BindingTemplate)bindingTemplateVector.elementAt(0);
accessPoint = bindingTemplate.getAccessPoint();
URLlist.add(accessPoint.getText());
}// 里面的for
}//外面的for
return URLlist;
}
}
juddiv3 客户端发布代码(转)
原创mb64216b23e45d0 博主文章分类:juddiv3 ©著作权
文章标签 java i++ 大小写 文章分类 JavaScript 前端开发
上一篇:Extjs交换
-
JUDDIV3 客户端代码(转载)java 数据库 开发工具 apache Test
-
JUDDIV3 部署
JUDDIV3部署了2天了,不用脑子的集成版就下了,用脑子的dist版怎么都不知道。哪
百度 MySQL 数据库 官网 -
juddiv3 部署到自己的tomcat中
How to install jUDDI on Tomcatof my ...
java 数据库 javascript ViewUI tomcat -
客户端离开代码
使用
C++ 套接字 客户端 聊天室