电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

程序分享:从UDDI注册中心查询服务


发布日期:2019/6/23
 

查询服务程序的实现过程创建Inquiry对象并设置查询地址声明FindBusiness对象并设置查询服务名和相关属性获得BusinessList对象然后层层向下查询BusinessList>BusinessInfo>ServiceInfo>BusinessService>BindingTemplate最后得到AccessPoint对象调用getText()方法就可获得该服务的入口地得到服务的WSDL之后可利用WSIF调用这个服务的方法见如下程序的方法

public void getServicesURL(){

try{

Inquiry inq=new Inquiry();

inqsetURL();

FindQualifiers fqs = new FindQualifiers();

FindBusiness fb = new FindBusiness();

fbsetFindQualifiers(fqs);

fbsetName(new Name(MagazineServices));//查找服务名MagazineServices的服务

BusinessList rBusinessList = inqfindBusiness(fb);

BusinessInfos rBusinessInfos = rBusinessListgetBusinessInfos();

Vector rBusinessInfoVector = rBusinessInfosgetBusinessInfoVector();

BusinessInfo rBusinessInfo;

for (int y =; y < rBusinessInfoVectorsize(); y++)

{

rBusinessInfo = (BusinessInfo)rBusinessInfoVectorelementAt(y);

Systemoutprintln(*********BUSINESS INFO********);

Systemoutprintln(Attribute BusinessKey: +rBusinessInfogetBusinessKey());

Name rName = rBusinessInfogetName();

Systemoutprintln(Name : +rNamegetValue());

Vector rDesVector = rBusinessInfogetDescriptionVector();

Description rDes=null;

printDescriptionVector(rDesVector);

ServiceInfos rSerInfos = rBusinessInfogetServiceInfos();

Vector rServiceInfoVector = rSerInfosgetServiceInfoVector();

ServiceInfo rServiceInfo;

for (int x =; x<rServiceInfoVectorsize();x++)

{

Systemoutprintln(*********Service Info********);

rServiceInfo = (ServiceInfo)rServiceInfoVectorelementAt(x);

Systemoutprintln(Service Info Name: +rServiceInfogetName()getValue());

Systemoutprintln(ServiceKey : +rServiceInfogetServiceKey());

Systemoutprintln(BusinessKey : +rServiceInfogetBusinessKey());

String magazineServer=rServiceInfogetServiceKey();

ServiceDetail rServiceDetail = inqgetServiceDetail(gsd);

Vector rBusinessServiceVector = rServiceDetailgetBusinessServiceVector();

BusinessService rBS;

for (int a=;a<rBusinessServiceVectorsize();a++)

{

Systemoutprintln(*****************BUSINESS SERVICE***************);

rBS = (BusinessService)rBusinessServiceVectorelementAt(a);

Vector rDesVector = rBSgetDescriptionVector();

BindingTemplates rBTs = rBSgetBindingTemplates();

if (rBTs !=null)

{

Vector rBTVector = rBTsgetBindingTemplateVector();

BindingTemplate returnBindingTemplate;

for (int i = ; i < returnBindingTemplateVectorsize(); i++)

{

Systemoutprintln(***********BINDING TEMPLATE*************);

returnBindingTemplate =(BindingTemplate)returnBindingTemplateVectorelementAt(i);

Vector rDesVector = returnBindingTemplategetDescriptionVector(); AccessPoint rAP = returnBindingTemplategetAccessPoint();

URL url=new URL(rAPgetText());//找到服务的URL地址

}

}

}

}

}

}catch(Exception e){

eprintStackTrace();

}

}

上一篇:利用VBScript实现倒计时

下一篇:VBScript基础教程之九VBScript过程