對(duì)于 WSDL 解析,有如下 3 種基本方法:
1. 基于 DOM 的方法:由于 WSDL 文件從本質(zhì)上來講是一個(gè) XML 文件,現(xiàn)有的 DOM API(例如 Xerces)能夠用來進(jìn)行解析或者構(gòu)建 WSDL 文件。這種方法是最通用的,但同時(shí)也是處理 XML 文件最費(fèi)力的方法。盡管從技術(shù)上來講是可行的,基于 DOM API 的實(shí)現(xiàn)對(duì)于代碼敏感且容易出錯(cuò)。同時(shí),這一解決方法迫使您不得不處理兩個(gè)完全不同的模型:DOM 和 WSDL 模型。
2. 基于特定 API 的方法: 利用 IBM 的 WSDL4J 來實(shí)現(xiàn) WSDL 操作就是一個(gè)例子。這種方法傾向于 WSDL 模型,它允許您直接操作 WSDL 。這種方法的不足在于您不僅要處理 WSDL 本身,還要處理 WS-Addressing、WS-Policy 和擴(kuò)展腳本。它同時(shí)還使用那些尚未成為標(biāo)準(zhǔn)的事物,這就意味著現(xiàn)有的一些 API 將會(huì)改變。在當(dāng)前,一些試驗(yàn)性的 API 支持 WS-Addressing 的當(dāng)前版本,但對(duì)于 WS-Policy 和擴(kuò)展腳本卻根本不支持。這就意味著這種基于特定 API 的方法不得不摻雜一定數(shù)量的 DOM 處理。
3. 基于 Java 生成的方法:因?yàn)槊枋鑫覀儗?shí)現(xiàn)的所有腳本都是標(biāo)準(zhǔn)的 XML 腳本,因此可以生成對(duì)應(yīng)于這些腳本的 Java 類(支持 XML 編組和分組)。在這種情況下, WSDL 文件直接轉(zhuǎn)化為 Java 類,然后作為 Java 對(duì)象來管理。考慮到標(biāo)準(zhǔn)在不斷進(jìn)化這一事實(shí),定制性的擴(kuò)展將是很有必要。由于它的靈活性和對(duì)變化的適應(yīng)性,這一方法最適合實(shí)現(xiàn)我們的解決方案。
對(duì)于WSDL模型目前有以下兩種:
1. JSR110規(guī)范,“Java APIs For WSDL”,是Java的WSDL1.1建模規(guī)范。
目前的實(shí)現(xiàn)是WSDL4J。最新版本為WSDL4J V1.6.2(2006-11-08)。
The Web Services Description Language for Java Toolkit (WSDL4J) allows the creation, representation, and manipulation of WSDL documents. Is the reference implementation for JSR110 'JWSDL'
網(wǎng)址為:http://sourceforge.net/projects/wsdl4j/
2. Apache Woden 開源項(xiàng)目。對(duì)WSDL2.0規(guī)范的建模。
最新版本為 Woden V1.0M7b(2007-08-03)
The Woden project is an incubation subproject of the Apache Web Services Project to develop a Java class library for reading, manipulating, creating and writing WSDL documents, initially to support WSDL 2.0 but with the longer term aim of supporting past, present and future versions of WSDL.
There are two main deliverables: an API and an implementation. The Woden API will consist of a set of Java interfaces. The WSDL 2.0-specific portion of the Woden API will conform to the W3C WSDL 2.0 specification. The implementation will be a high performance implementation directly usable in other Apache projects such as Axis2.
網(wǎng)址是:http://ws.apache.org/woden/index.html
Author: orangelizq
email: orangelizq@163.com
posted on 2008-04-08 20:40
桔子汁 閱讀(2261)
評(píng)論(0) 編輯 收藏 所屬分類:
Web Service