使用J2EE建立基于XML的网络服务(5)

类别:Java 点击:0 评论:0 推荐:

 

5       进行后端集成(Performing Back-End Integration)

使用J2EE建立网络服务的最后一个挑战是连接到后台,例如数据库、传统系统和其它商业伙伴软件系统。

5.1    数据库连接(Database Connectivity )

为了和传统的数据库连接,开发者可以选择下面的API:

译者注:下面这些定义已经很古老,为了保持完整性请看原文:

The JDBC API is a relational database API used to access any SQL-compliant database. JDBC isolates you from the specific protocol and syntax of a particular database, yielding more portable code. JDBC is a widely accepted standard, and a myriad of JDBC drivers are available for download today.

SQL/J is a standard for embedding SQL logic directly into Java code. This is somewhat analogous to how JSP components interlace Java code within HTML tags.

5.2    传统系统的连接(Legacy System Connectivity)

译者注:由于这些和国内的情况不是很相关,略去翻译,有兴趣请看原文:

Connecting to existing systems has historically been one of the most challenging and burdensome tasks of creating any enterprise deployment. Most enterprises comprise a hodgepodge of existing systems such as SAP R/3, Siebel, i2, and custom systems. Integration has been a manual task, because there are very few adapters available for existing systems. ISVs have been required to write custom adapters for every platform, but this lack of a standard platform has left little or no incentive for ISVs to do this.

The J2EE Connector Architecture (JCA) is an industry movement that is spawning a marketplace of adapters to existing systems. Using the JCA, you can download or purchase an off-the-shelf adapter to connect to an existing system. You can also write your own, if no such adapter exists. These adapters can run in any J2EE-compliant environment.

With the JCA, you gain the benefits of the "write once, run anywhere" paradigm - write the adapters once, and run them in any J2EE environment. For ISVs of existing systems (such as SAP), this creates a unique opportunity for them to solve integration problems for their clients. Indeed, adapters are already being developed as we speak, and this is what makes the JCA so exciting for end developers.

 

5.3    商业伙伴连接(Business Partner Connectivity)

最后一种类型的后台系统我们可能要连接的是商业伙伴的网络服务。这些商业伙伴使用一样的全球达成协议的XML标准来呈现自己,我们可以在发布我们自己的网络服务时可以使用这些。也就是说,用UDDI作为网络服务的注册表,WSDL作为网络服务的描述,SOAP和ebXML用来处理商业事物。

你的EJB组件层能使用前面讲到的JAX开头的一系列API来调用商业伙伴的网络服务。

使用Java API for XML Registries (JAXR) 来查找商业伙伴发布在UDDI注册表中的网络服务

使用Java API for XML RPC (JAX/RPC)来进行对外部网络服务请求给出RPC响应。

使用Java API for XML Messaging (JAXM) 来发送SOAP 或 ebXML 消息给外部网络服务

使用Java API for XML Parsing (JAXP) Java API for XML Binding (JAXB) 来转换Java 数据 (例如从数据库中导入的数据) 为适用于合作伙伴的XML格式。你可以使用一样的API来转换接收的XML数据为Java数据结构也可用XSLT 转换来转换schemas。

       使用J2EE网络服务架构中Java标准API,我们可以建立功能强大的可以和我们的合作伙伴共享的跨平台系统,从而实现一个端到端的网络服务解决方案图7显示了这个架构。

图 7  使用JAX* API来调用商业网络服务

6       结论

本文中,我们回顾了如何使用J2EE来建立网络服务。使用J2EE建立网络服务最重要的好处在于使用已有的J2EE基本架构来完成70%到90%的网络服务系统功能。开发者保留所有一个基于最好发展的J2EE系统标准的好处,且继续掌握来之不易的J2EE技巧。一个网络服务架构的实现有着很大的灵活性。开发者在实现特定的功能前可以先考虑高层的架构,你可以在实现时使用最适合企业需求的私有组件或者和标准有很大出入的组件。

采用J2EE网络服务架构的开发者可以继续关注正在不断扩展的标准和功能。开发者现在可以利用现存的诸如servlets,JSP,EJB和JAXP以及众多的SOAP、WSDL和ebXML工具。即将出台的更高级的JAX系列API将进一步简化网络服务开发并提供戏剧性的开发能力的增长。标准和私有组件的不断发展将进一步加强他们开发强有力解决方案的能力。

 

注:

翻译:曹勇刚,部分内容有节选和加入作者的理解,时间有限,可能有错误或者遗漏的地方,请参看原文。

另外,由于贴时发现从word中自动生成的序号在分块粘贴时章节号被重新编号,且图片都没有,木已成舟,就不再重贴了,希望读者注意!章节号可能不对。不过从头到尾(1-5)阅读并不影响内容。

源文件来自http://www.theserverside.com/resources/article.jsp?l=WebServices-Dev-Guide:

Developer's Guide to Building XML-based Web Services with the Java 2 Platform, Enterprise Edition (J2EE)

By James Kao June 2001 ,Prepared for Sun Microsystems, Inc.

本文地址:http://com.8s8s.com/it/it18570.htm