Links: Table of Contents | Single HTML | Single PDF

Chapter 17. Modular Databinding

Table of Contents

17.1. Introduction
17.2. Configure databinding for JVM
17.3. Configure databinding for an endpoint

17.1. Introduction

The JAX-WS reference implementation (RI) used to be dependent on the JAXB RI for databinding. JAXB and JAX-WS implementations have been decoupled in Metro 2.2 release, and databinding is now modular. The Eclipselink JAXB implementation, plus EclipseLink extensions, is called MOXy. The org.eclipse.persistence.moxy.jar file is bundled with GlassFish Server, which supports the JAXB RI and MOXy as databinding providers. For standalone distributions, databinding plugins can be found in lib/databinding folder in the distribution. The MOXy implementation (library) is not bundled with Metro. It's expected from user to provide MOXy jars to classpath whenever MOXy databinding is required. EclipseLink JAXB compiler is not included as well, but can be used with GlassFish Server. Download the EclipseLink zip file at and unzip it.

17.2. Configure databinding for JVM

To specify the databinding provider for the JVM, set the JVM property to one of the following values:

  • Specifies the JAXB reference implementation. This is the default.
  • Specifies the EclipseLink MOXy JAXB binding.

For example:

asadmin create-jvm-options

17.3. Configure databinding for an endpoint

To specify the databinding provider for a web service endpoint:

  • Set the feature during WebServiceFeature list initialization or using the add method. Allowed values are as follows:
    • Specifies the JAXB reference implementation. This is the default.
    • Specifies Eclipselink MOXy JAXB binding.
    For example:
    WebServiceFeature[] features = { new DatabindingModeFeature(JAXBContextFactory.ECLIPSELINK_JAXB)};
  • Set the feature using the @DatabindingMode annotation. For example:
    import javax.jws.WebService;
  • Set the databinding attribute of the endpoint element in the sun-jaxws.xml file. Allowed values are glassfish.jaxb or eclipselink.jaxb. For example: