對于 WSDL 解析,有如下 3 種基本方法:
1. 基于 DOM 的方法:由于 WSDL 文件從本質上來講是一個 XML 文件,現有的 DOM API(例如 Xerces)能夠用來進行解析或者構建 WSDL 文件。這種方法是最通用的,但同時也是處理 XML 文件最費力的方法。盡管從技術上來講是可行的,基于 DOM API 的實現對于代碼敏感且容易出錯。同時,這一解決方法迫使您不得不處理兩個完全不同的模型:DOM 和 WSDL 模型。
2. 基于特定 API 的方法: 利用 IBM 的 WSDL4J 來實現 WSDL 操作就是一個例子。這種方法傾向于 WSDL 模型,它允許您直接操作 WSDL 。這種方法的不足在于您不僅要處理 WSDL 本身,還要處理 WS-Addressing、WS-Policy 和擴展腳本。它同時還使用那些尚未成為標準的事物,這就意味著現有的一些 API 將會改變。在當前,一些試驗性的 API 支持 WS-Addressing 的當前版本,但對于 WS-Policy 和擴展腳本卻根本不支持。這就意味著這種基于特定 API 的方法不得不摻雜一定數量的 DOM 處理。
3. 基于 Java 生成的方法:因為描述我們實現的所有腳本都是標準的 XML 腳本,因此可以生成對應于這些腳本的 Java 類(支持 XML 編組和分組)。在這種情況下, WSDL 文件直接轉化為 Java 類,然后作為 Java 對象來管理。考慮到標準在不斷進化這一事實,定制性的擴展將是很有必要。由于它的靈活性和對變化的適應性,這一方法最適合實現我們的解決方案。
對于WSDL模型目前有以下兩種:
1. JSR110規范,“Java APIs For WSDL”,是Java的WSDL1.1建模規范。
目前的實現是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'
網址為:http://sourceforge.net/projects/wsdl4j/
2. Apache Woden 開源項目。對WSDL2.0規范的建模。
最新版本為 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.
網址是:http://ws.apache.org/woden/index.html
Author: orangelizq
email: orangelizq@163.com
|
|