package
juddiv3admin.juddiv3;
import
java.awt.Frame;
import
javax.swing.SwingWorker;
import
juddiv3admin.Juddiv3Admin;
import
juddiv3admin.gui.GUI;
import
juddiv3admin.gui.SwingWorkerCompletionWaiter;
import
org.apache.juddi.api_v3.*;
import
org.apache.juddi.v3.client.ClassUtil;
import
org.apache.juddi.v3.client.config.UDDIClientContainer;
import
org.apache.juddi.v3.client.transport.Transport;
import
org.apache.juddi.v3_service.JUDDIApiPortType;
import
org.uddi.api_v3.*;
import
org.uddi.v3_service.*;
public
class
Tools
{
private
static
UDDISecurityPortType security = null
;
private
static
JUDDIApiPortType juddiApi = null
;
private
static
UDDIPublicationPortType publish = null
;
private
static
UDDIInquiryPortType inquiry = null
;
public
Tools() throws
Exception
{
String clazz = UDDIClientContainer.getUDDIClerkManager(null
).getClientConfig().getUDDINode("default"
).getProxyTransport();
Class<?> transportClass = ClassUtil.forName(clazz, Transport.class
);
if
(transportClass != null
)
{
Transport transport = (Transport) transportClass.getConstructor(String.class
).newInstance("default"
);
security = transport.getUDDISecurityService();
juddiApi = transport.getJUDDIApiService();
publish = transport.getUDDIPublishService();
inquiry = transport.getUDDIInquiryService();
}
publisherWorker = new
PublisherWorker();
businessWorker = new
BusinessWorker();
serviceWorker = new
SerivceWorker();
}
public
AuthToken currentAuthToken = null
;
PublisherWorker publisherWorker = null
;
BusinessWorker businessWorker = null
;
SerivceWorker serviceWorker = null
;
public
AuthToken getAuthToken(String userID, String cred) throws
Exception
{
GetAuthToken getAuthToken = new
GetAuthToken();
getAuthToken.setUserID(userID);
getAuthToken.setCred(cred);
return
security.getAuthToken(getAuthToken);
}
public
void
discardAuthToken(AuthToken authToken) throws
Exception
{
DiscardAuthToken dat = new
DiscardAuthToken();
dat.setAuthInfo(authToken.getAuthInfo());
security.discardAuthToken(dat);
}
public
Object submitQuery(final
Frame frame, final
Object query) throws
Exception
{
SwingWorker swingWorker = new
SwingWorker()
{
@Override
protected
Object doInBackground()
{
try
{
//#####################
//business
if
(query instanceof
FindBusiness)
{
return
businessWorker.findBusinessDetail((FindBusiness) query);
}
if
(query instanceof
SaveBusiness)
{
return
businessWorker.saveBusiness((SaveBusiness) query);
}
if
(query instanceof
DeleteBusiness)
{
return
businessWorker.deleteBusiness((DeleteBusiness) query);
}
//service
if
(query instanceof
FindService)
{
return
serviceWorker.findServiceDetail((FindService) query);
}
if
(query instanceof
SaveService)
{
return
serviceWorker.saveService((SaveService) query);
}
if
(query instanceof
DeleteService)
{
return
serviceWorker.deleteService((DeleteService) query);
}
//publisher
if
(query instanceof
GetAllPublisherDetail)
{
return
publisherWorker.findPublisherAll((GetAllPublisherDetail) query);
}
if
(query instanceof
SavePublisher)
{
return
publisherWorker.savePublisher((SavePublisher) query);
}
if
(query instanceof
DeletePublisher)
{
publisherWorker.deletePublisher((DeletePublisher) query);
return
true
;
}
//#####################
return
null
;
} catch
(Exception e)
{
GUI.ShowError(frame, e);
return
null
;
}
}
};
SwingWorkerCompletionWaiter.showJDialog(frame, true
, swingWorker, "Submitting Query ..."
);
return
swingWorker.get();
}
// ------------------------ PublisherWorker ------------------------
public
class
PublisherWorker
{
public
PublisherDetail findPublisherAll(GetAllPublisherDetail gapd) throws
Exception
{
return
juddiApi.getAllPublisherDetail(gapd);
}
public
PublisherDetail savePublisher(SavePublisher savePublisher) throws
Exception
{
return
juddiApi.savePublisher(savePublisher);
}
public
void
deletePublisher(DeletePublisher deletePublisher) throws
Exception
{
juddiApi.deletePublisher(deletePublisher);
}
}
// ------------------------ end of PublisherWorker ------------------------
// ------------------------ BusinessWorker ------------------------
public
class
BusinessWorker
{
public
BusinessDetail saveBusiness(SaveBusiness saveBusiness) throws
Exception
{
return
publish.saveBusiness(saveBusiness);
}
public
DispositionReport deleteBusiness(DeleteBusiness deleteBusiness) throws
Exception
{
return
publish.deleteBusiness(deleteBusiness);
}
public
BusinessList findBusiness(FindBusiness findBusiness) throws
Exception
{
return
inquiry.findBusiness(findBusiness);
}
public
BusinessDetail findBusinessDetail(FindBusiness findBusiness) throws
Exception
{
return
findBusinessDetail(findBusiness(findBusiness));
}
public
BusinessDetail findBusinessDetail(BusinessList businessList) throws
Exception
{
if
(businessList == null
)
{
return
null
;
}
if
(businessList.getBusinessInfos() == null
)
{
return
null
;
}
GetBusinessDetail gbd = new
GetBusinessDetail();
for
(BusinessInfo businessInfo : businessList.getBusinessInfos().getBusinessInfo())
{
gbd.getBusinessKey().add(businessInfo.getBusinessKey());
}
return
inquiry.getBusinessDetail(gbd);
}
}
// ------------------------ end of BusinessWorker ------------------------
// ------------------------ SerivceWorker ------------------------
public
class
SerivceWorker
{
public
DispositionReport deleteService(DeleteService deleteService) throws
Exception
{
return
publish.deleteService(deleteService);
}
public
ServiceDetail saveService(SaveService saveService) throws
Exception
{
return
publish.saveService(saveService);
}
public
ServiceList findService(FindService findService) throws
Exception
{
return
inquiry.findService(findService);
}
public
ServiceDetail findServiceDetail(ServiceList serviceList) throws
Exception
{
if
(serviceList == null
)
{
return
null
;
}
if
(serviceList.getServiceInfos() == null
)
{
return
null
;
}
GetServiceDetail gsd = new
GetServiceDetail();
for
(ServiceInfo serviceInfo : serviceList.getServiceInfos().getServiceInfo())
{
gsd.getServiceKey().add(serviceInfo.getServiceKey());
}
return
inquiry.getServiceDetail(gsd);
}
public
ServiceDetail findServiceDetail(FindService findService) throws
Exception
{
return
findServiceDetail(findService(findService));
}
}
// ------------------------ end of SerivceWorker ------------------------
}
分享到:
相关推荐
在本场景中,我们将讨论如何使用**soapUI**工具来对JUDDIV3执行关键操作,如**注册**、**查询**和**发布**服务。 1. **注册服务**: 在JUDDI中注册服务是将Web服务信息存储到JUDDI服务器的过程。首先,你需要创建...
在java开发services中,会用到: 1.webservices-api.jar 2.webservices-extra.jar 3.webservices-rt.jar 4.webservices-tools.jar 5.webservices-extra-api.jar 此压缩文件里就是这五个jar文件。
它允许服务提供者发布服务信息到UDDI目录,而服务消费者可以通过查询这个目录找到所需的服务。在Java世界中,JAXR(Java API for XML Registries)是与各种XML注册库交互的API,包括UDDI。 为了实现Web Services的...
3. **WSDL (Web Services Description Language)**:WSDL 是一个 XML 文件,它定义了 Web Service 的接口,包括服务的位置(URL)、可用的操作、输入和输出参数等。WSDL 通过 HTTP 发布,供客户端程序发现和理解服务...
WEB SERVICES原理与研发实践
WebServices是一种基于互联网的、用于应用程序之间交互的技术。在本项目"WebServices 天气预报"中,开发者提供了一个简单的天气预报应用,旨在帮助初学者理解WebServices的工作原理及其在C# WinForm环境中的实现。这...
Web Services技术架构是一种基于互联网的、开放的、标准的接口技术,它允许不同的应用程序之间进行交互和数据交换。这一概念由微软的MCT(Microsoft Certified Trainer)和MVP(Microsoft Most Valuable ...
简单易懂,学习的好资料,Creating Web Services and hosting them (Using C#).zip,创建和个web服务工程和发布这个工程,Creating Web Services and hosting them (Using C#).zip,创建和个web服务工程和发布这个...
3. **webservices-extra-api**: 类似于`webservices-api`,但可能更专注于提供扩展功能的API接口,使得开发者能够访问和操作那些在基础API中未涵盖的Web服务特性。 4. **webservices-rt**: "rt"通常代表...
### 金蝶K/3基于WebServices外部数据交换接口使用指南 #### 概述与目的 随着企业信息化水平的不断提高,各类业务系统如ERP、CRM、OA等在组织内部的应用日益广泛,这些系统往往需要跨不同的平台运行。为了实现不同...
Exchange Web Services 2.2
【Web Services概述】 Web Services是一种计算分布式问题的技术,它允许不同系统间的应用程序通过网络进行通信,从而实现数据的共享和程序的互操作性。Web Services的核心目标是促进系统的整合、标准化,并提供一种...
UDDI是一种标准的目录服务,用于发布、查找和管理Web Services。它提供了一个注册系统,使得服务提供者可以发布他们的服务信息,而服务消费者则可以通过查询UDDI目录找到所需的服务。UDDI目录包含关于Web Services...
本书的内容涵盖了Web Services的各种关键技术、Web Services的整体体系架构和应用体系架构,以及Web Services应用的设计和开发。本书以Web Services技术系列为主线,逐一详细分析解释包括Web Services的各种核心技术...
### Web Services 学习基础 #### 一、Web Services 概述 Web Services 是一种用于在不同平台上交换数据和服务的标准方式。它允许不同系统之间进行通信,并且可以在各种不同的编程语言和技术栈中运行。Web Services...
3. 使用Web Services: - 一旦Web Service发布,客户端可以通过生成代理类或者手动编写代码来调用服务。在.NET中,可以使用“添加Web引用”或“添加服务引用”来自动生成代理类。 - 调用服务的方法与调用本地方法...
标题 "Spring Web Services 框架入门研究--发布服务" 提到的是关于使用Spring框架构建Web服务的内容。Spring Web Services是Spring生态体系中的一部分,它专注于创建基于SOAP(Simple Object Access Protocol)的互...
Microsoft.Web.Services3,用于配合Net 更好调用提供webservice
3. **云服务**:许多云平台提供API以Web Services形式,允许开发者轻松调用云服务,如存储、计算等。 六、挑战与未来趋势 1. **安全性**:Web Services的安全性是关键问题,包括数据加密、身份验证、授权等,WS-...
- **UDDI(Universal Description, Discovery and Integration)**:UDDI是一种目录服务,服务提供者在这里发布他们的服务信息,而服务消费者可以查找和选择适合的Web Services。 Web Services的未来在于其潜力,...