怎样判断一个服务器上是否有webservice c#实现 15
在客户端写一个程序来判断指定的ip是否有webservice,之前想用httprequest请求一个确定的asmx文件,不知道能不能用其他的办法解决。一楼的代码不好读啊,...
在客户端写一个程序来判断指定的ip是否有webservice,之前想用httprequest请求一个确定的asmx文件,不知道能不能用其他的办法解决。
一楼的代码不好读啊,拿着msdn搜读不懂,有些类是你自己写的吧!
不过还得谢谢你!
再次说明一下,我的问题是局域网有机器若干,我采用for循环在一个网段内扫描,将包含webservice的机器ip收集下来,存到本地。 展开
一楼的代码不好读啊,拿着msdn搜读不懂,有些类是你自己写的吧!
不过还得谢谢你!
再次说明一下,我的问题是局域网有机器若干,我采用for循环在一个网段内扫描,将包含webservice的机器ip收集下来,存到本地。 展开
1个回答
展开全部
以下代码演示了根据给定注册中心使用的WSDL规范实例来查找一个机构。
String schemeName = "uddi-org:types";
ClassificationScheme uddiOrgTypes = bqm.findClassificationSchemeByName(null, schemeName);
/*
* Create a classification, specifying the scheme
* and the taxonomy name and value defined for WSDL
* documents by the UDDI specification.
*/
Classification wsdlSpecClassification = blcm.createClassification(uddiOrgTypes, "wsdlSpec", "wsdlSpec");
ArrayList classifications = new ArrayList(); classifications.add(wsdlSpecClassification);
// Find concepts
BulkResponse br = bqm.findConcepts(null, null, classifications, null, null);
接着,你必须遍历concept,找到它们对应的WSDL文件,并显示出使用每个文件的机构:
// Display information about the concepts found
Collection specConcepts = br.getCollection();
Iterator iter = specConcepts.iterator();
if (!iter.hasNext()) {
System.out.println("No WSDL specification concepts found");
} else {
while (iter.hasNext()) {
try{
Concept concept = (Concept) iter.next();
String name = getName(concept);
Collection links = concept.getExternalLinks();
System.out.println("\nSpecification Concept:\n Name: " +name + "\n Key: " + concept.getKey().getId() + "\n Description: " + getDescription(concept));
if (links.size() > 0) {
ExternalLink link =
(ExternalLink) links.iterator().next();
System.out.println("URL of WSDL document: '" link.getExternalURI() + "'");
}
// Find organizations that use this concept
ArrayList specConcepts1 = new ArrayList();
specConcepts1.add(concept);
br = bqm.findOrganizations(null, null, null, specConcepts1, null, null);
Collection orgs = br.getCollection();
// Display information about organizations
... }
查找服务和服务绑定
以下代码演示了getService()和getServiceBindings()方法的使用:
Iterator orgIter = orgs.iterator();
while (orgIter.hasNext()) {
Organization org = (Organization) orgIter.next();
Collection services = org.getServices();
Iterator svcIter = services.iterator();
while (svcIter.hasNext()) {
Service svc = (Service) svcIter.next();
Collection serviceBindings = svc.getServiceBindings();
Iterator sbIter = serviceBindings.iterator();
while (sbIter.hasNext()) {
ServiceBinding sb =
(ServiceBinding) sbIter.next();
}
}
}
String schemeName = "uddi-org:types";
ClassificationScheme uddiOrgTypes = bqm.findClassificationSchemeByName(null, schemeName);
/*
* Create a classification, specifying the scheme
* and the taxonomy name and value defined for WSDL
* documents by the UDDI specification.
*/
Classification wsdlSpecClassification = blcm.createClassification(uddiOrgTypes, "wsdlSpec", "wsdlSpec");
ArrayList classifications = new ArrayList(); classifications.add(wsdlSpecClassification);
// Find concepts
BulkResponse br = bqm.findConcepts(null, null, classifications, null, null);
接着,你必须遍历concept,找到它们对应的WSDL文件,并显示出使用每个文件的机构:
// Display information about the concepts found
Collection specConcepts = br.getCollection();
Iterator iter = specConcepts.iterator();
if (!iter.hasNext()) {
System.out.println("No WSDL specification concepts found");
} else {
while (iter.hasNext()) {
try{
Concept concept = (Concept) iter.next();
String name = getName(concept);
Collection links = concept.getExternalLinks();
System.out.println("\nSpecification Concept:\n Name: " +name + "\n Key: " + concept.getKey().getId() + "\n Description: " + getDescription(concept));
if (links.size() > 0) {
ExternalLink link =
(ExternalLink) links.iterator().next();
System.out.println("URL of WSDL document: '" link.getExternalURI() + "'");
}
// Find organizations that use this concept
ArrayList specConcepts1 = new ArrayList();
specConcepts1.add(concept);
br = bqm.findOrganizations(null, null, null, specConcepts1, null, null);
Collection orgs = br.getCollection();
// Display information about organizations
... }
查找服务和服务绑定
以下代码演示了getService()和getServiceBindings()方法的使用:
Iterator orgIter = orgs.iterator();
while (orgIter.hasNext()) {
Organization org = (Organization) orgIter.next();
Collection services = org.getServices();
Iterator svcIter = services.iterator();
while (svcIter.hasNext()) {
Service svc = (Service) svcIter.next();
Collection serviceBindings = svc.getServiceBindings();
Iterator sbIter = serviceBindings.iterator();
while (sbIter.hasNext()) {
ServiceBinding sb =
(ServiceBinding) sbIter.next();
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询