JiBX in Axis2JiBX has been supported for use in the Axis2 web services framework since Axis2 1.0. The basic information on using JiBX is included in the Axis2 download, but as the Axis2 documentation is going through continual changes the information on JiBX can tend to get lost. This page is intended as a primary source of information for anyone using JiBX with Axis2, including some of the related JiBX tools which are not included in the Axis2 distribution. One good source of information and examples is JiBX primary developer Dennis Sosnoski's Axis2 Data Binding article on IBM developerWorks. This article includes examples demonstrating how to implement the same web service using Axis2's custom ADB binding framework, JiBX, and XMLBeans. It also includes some discussion of the strengths and weaknesses of the different approachs. You need to update your Axis2 installation to make use of JiBX 1.2.x. The jibx-axis2 distribution package provides the update to Axis2, in the form of a jar file replacing one of the Axis2 jars and an Ant build.xml that handles the actual file copying (including copying the appropriate jars from your JiBX installation into the Axis2 installation). Once you've done the updates, you should be able to use all features of Axis2 with JiBX 1.2.x. JiBX is especially well-suited to exposing existing Java code as a web service, using the Jibx2Wsdl tool. Jibx2Wsdl is a far-superior alternative to the Java2WSDL tool included in the Axis2 distribution. It includes support for Java 5 enumerations and typed collections, and also provides an extensive customization mechanism that allows you to "tune" the schemas and WSDL generated from your Java code. If you're instead developing a web service starting from WSDL you can still use JiBX, but you need to do more work "manually" since the Axis2 WSDL2Java tool expects you to have an existing binding and classes for JiBX. The CodeGen tool can generate the necessary bindings and classes for you, if you first extract the schema definitions from your WSDL (since it currently only works with standalone schema definitions, not schemas embedded inside WSDL). If your WSDL follows the "wrapped" style (where each <wsdl:message> consists of a single schema element reference, and each of these elements consists only of a sequence of child elements) you just need to generate the data structure definitions used by the child elements, not the wrapper elements referenced from <wsdl:message> definitions. For a discussion of the issues involved in either starting from code or starting from WSDL when developing a web service you can see Dennis Sosnoski's "Code First" Web Services Reconsidered. |