December 16, 2011

EclipseLink MOXy is the JAXB Provider in WebLogic Server 12c

I am very happy to announce that EclipseLink JAXB (MOXy) is now the default JAXB (JSR-222) provider in WebLogic Server 12c.  I would like to thank the EclipseLink committers and the WebLogic team for all their hard work to make this happen.

In this post I will introduce how MOXy can be leveraged to create a JAX-WS service.  In future posts I will cover more of the extensions in greater detail.

WebLogic Server 12c can be downloaded from OTN at the following link:

December 5, 2011

Reusing Generated JAXB Classes

In this post I will demonstrate how to leverage the -episode XJC extension to reuse classes previously generated from.an XML schema.  This is useful when an XML schema is imported by other XML schemas and you do not want the same classes generated each time.

November 30, 2011

JAXB and Namespace Prefixes

In a previous post I covered how to use namespace qualification with JAXB.  In this post I will cover how to control the prefixes that are used.  This is not covered in the JAXB (JSR-222) specification but I will demonstrate the extensions available in both the reference and EclipseLink MOXy implementations for handling this use case.

October 12, 2011

JAXB (XJC) Imported Schemas and XML Catalogs

XML schema has a power mechanism called "import".  Import allows one XML schema to reference elements and types from another XML schema.  This means you could define types to represent commonly used information once and import these types into other XML schemas. Like any powerful tool, the import mechanism also has the ability to inflict pain.  In this post I'll demonstrate how to leverage an XML catalog to eliminate the pain when using JAXB's XJC tool to generate classes from an XML schema with imports.

September 30, 2011

Mixing Nesting and References with JAXB's XmlAdapter

Recently I came across a question on Stack Overflow asking if JAXB could marshal the first occurrence of an object as containment and all subsequent occurrences as a reference.  Below is an expanded version of my answer (up votes appreciated) demonstrating how this can be achieved by leveraging JAXB's XmlAdapter.

September 8, 2011

Mapping Objects to Multiple XML Schemas - Weather Example

I have written previous posts on EclipseLink JAXB (MOXy)'s @XmlPath and external binding file extensions.  In this post I will demonstrate how powerful these extensions are by mapping a single object model to two different XML schemas.  To make the example more "real", the XML data will come from two different services that provide weather information:  Google and Yahoo.

August 25, 2011

XML Schema to Java - Generating XmlAdapters

In previous posts I have demonstrated how powerful JAXB's XmlAdapter can be when starting from domain objects.  In this example I will demonstrate how to leverage an XmlAdapter when generating an object model from an XML schema.  This post was inspired by an answer I gave to a question on Stack Overflow (feel free to up vote).

August 24, 2011

JAXB and Enums

Today I answered a question on Stack Overflow (feel free to up vote) about JAXB and generating Java enums from an XML Schema.  This is normally straight forward, but there are a couple "gotchas" to be aware of.  In this post I'll demonstrate an easy and a harder use case.

August 23, 2011

JAXB and Java IO (Files, Streams, Readers, and Writers)

JAXB supports many different XML sources and targets.  In this post I'll give an overview of how JAXB can be used with those found in the java.io package: File, InputStream, OutputStream, Reader, Writer and their subclasses.

August 19, 2011

Binding to JSON & XML - Geocode Example

In a previous post I introduced the JSON binding that was added in the MOXy component in EclipseLink 2.4.  In that post I explained how the same metadata that is used for XML binding can be directly applied to JSON binding.  In this post I will demonstrate how powerful this is, by mapping one object model to both XML and JSON using the same set of metadata.  Google Maps Geocoding API V2 will be used to provide the XML and JSON inputs for this example.

You can try this out now using a download available from: