Using JiBX in Axis2

# Using JiBX in Axis2 |

JiBX Basics Overview Flexibility Performance Clean code News and Status User Comments Sponsors Support and Training Bugs Getting Started Binding Tutorial A basic binding Binding extras Structure mapping Collections and arrays Using mappings Advanced binding Method hooks Custom code Binding Compiler Binding on Load Runtime JiBX Extras Building JiBX Schema Compatibility Mailing Lists FAQ Contributing License Binding Definition Definition details Definition contexts 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 Generator Tools Axis2 Usage JibxSoap Xsd2Jibx | ### 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. There's also a wiki page discussing an earlier version of the same service example. The wiki discussion includes a separate page with details of the Axis2 SOAP Fault handling, a particularly confusing aspect of working with Axis2. JiBX is currently (as of the 1.1.x releases) most beneficial when working with existing Java code which implements the functionality which is to be exposed as a web service. The Jibx2Wsdl tool (discussed below) is especially useful for that purpose, even for developers using Axis2 with other data binding frameworks. 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 Xsd2Jibx tool can help you to get set up for this, if you first extract the schema definitions from your WSDL (and in the case of a "wrapped" style WSDL you only need to extract the schema definitions for the actual data components, not the wrapper elements). But Xsd2Jibx is very limited, and will not handle complex schema definitions correctly. The JiBX 1.2 development includes a replacement for Xsd2Jibx which handles a much wider range of schema constructs. 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. ### Jibx2Wsdl 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. Jibx2Wsdl is officially part of the JiBX 1.2 development, and full documentation will be available with the first 1.2 beta release. For now, the best source of information on Jibx2Wsdl is the "Code First" Web Services Reconsidered article and the wiki page.