Using JiBX in Axis2

# Using JiBX in Axis2 |

JiBX Basics Overview Getting Started Binding Compiler Binding on Load Runtime Extras Building JiBX Maven Contributing License News and Status Support FAQ Mailing Lists Bugs User Comments Sponsors Start from Code Start from Code BindGen Example Code Example 1 Example 2 Example 3 Example 4 Customizations Reference SchemaGen Jibx2Wsdl Examples Customizations Start from Schema Start from Schema CodeGen Schema Datatype Handling Example Code Default Generation Simple Customizations More Customizations Modular Generation Customizations Reference Extensions Reference Binding Definition Binding Tutorial A basic binding Binding extras Structure mapping Collections and arrays Using mappings Advanced binding Method hooks Custom code Precompiled Bindings Definition details Definition contexts Conversions Date/time conversions XML summary <binding> element <include> element <format> element <namespace> element <mapping> element <value> element <structure> element <collection> element Attribute groups Usage API Runtime JavaDocs Subprojects Eclipse Plug-in Introduction Install Usage JiBX/WS Axis2 Usage JiBX/OTA Schema Library | ### JiBX in Axis2 JiBX 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.