What is JiBX/OTA?

JiBX/OTA is a set of examples and sample code intended to help developers working with the Open Travel Alliance schemas. It includes two different examples of JiBX code generation from the OTA schemas, an example of WSDL generation from a Java interface for a web service based on OTA messages, and two different sample implementations of a client and server for the web service.

JiBX offers a number of advantages over alternative data binding frameworks for working with the OTA schemas. For starters, it does a better job of handling schema definitions:

  • <xs:documentation> items in schema definitions are converted to JavaDocs, making relevant documentation directly available to developers
  • <xs:choice> components are converted to type-safe representations with (optionally) checked get/set methods to prevent usage errors
  • Repeated components in the schema definition, including repeated <xs:choice> components, are represented with type-safe arrays or (for Java 5 and above) typed lists
  • Unused common definitions are ignored, and definitions used only in one place are inlined, where possible, avoiding the creation of unnecessary added classes

JiBX also provides much greater flexibility than other alternatives, including easy ways to:

  • Selectively generate only the schema components required for specific messages
  • Simplify schema definitions by deleting components not needed for your application (without any modification to the actual schemas)
  • Use the popular Joda date/time types for better representations of schema data/time types
  • Substitute one schema type for another, allowing the use of simpler Java equivalents (such as int or long in place of java.math.BigInteger
  • Extend the code generation with supplied decorators for purposes such as adding java.io.Serializable handling to generated classes (or with your own custom decorators)
  • Choose between Java 5 typed lists and arrays or untyped lists, and between Java 5 enums and custom enumeration types, for compatibility with older JVMs
  • Build modular representations, so that development teams can control the portions of the data model relevant to their own work without effecting other teams

On the web services side, JiBX gives the best support for generating WSDL service definitions from code (even if you're not actually using JiBX at runtime). When used with the JiBX/WS web services framework JiBX also provides the fastest web services available, including support for XBIS encoding which doubles your speed in converting to and from XML while cutting data volumes in half. JiBX/WS also gives the flexibility of using direct XML document exchanges (without SOAP wrappers), and efficient TCP socket transport (both with and without SOAP).

Before you start

Before you can try out any of the JiBX/OTA examples you'll first need to download the current JiBX code and whichever version of the OTA schema distribution you're planning to use (available from the OTA Specifications page - the current build of JiBX/OTA has been tested with the OTA 2009A schemas, and partially tested with the 2010A public review schemas, but prior versions of the OTA schemas have also been used with JiBX code generation). You'll also need to have a Java 5 or later distribution installed on your development system (JiBX itself is compatible with older versions of Java, and can also generate code compatible with older versions of Java, but the examples are configured to use Java 5 typed collections). Finally, you'll need the Apache Ant build tool installed on your development system.

For the web service implementation examples you'll also need the appropriate web service stack - either Apache Axis2 or JiBX/WS - and a Java web server such as Apache Tomcat.

Download structure

JiBX/OTA download structure

The distribution uses a hierarchy of directories for the different examples. At the root is the data model example, demonstrating code generation from the OTA schemas. The root level also includes this documentation, in the docs directory. The test directory contains test code which uses the generated data model to roundtrip sample documents provided with the OTA schemas, first unmarshalling each document into a data model structure, then marshalling the data model back to XML, and finally comparing the marshalled XML document with the original.

The webservice directory contains the web service demonstration code. The base directory contains source code for a Java interface class defining methods using the OTA request and response documents relating to air travel. This interface is used as input to the Jibx2Wsdl tool included in the JiBX distribution, which generates a WSDL service description from the interface. The axis2 and jibxws directories contain the code for two different implementations of the service, using the respective web services stacks.

Getting started

You need to build a data model first, as discussed on the Data Models page. Once you have a data model, you can run the WSDL Generation step to create a WSDL service definition. You can then use the WSDL to build a Axis2 Implementation and/or a JiBX/WS Implementation of the web service.