How WSDLToJava in cxf works?

sskumar86 picture sskumar86 · Jan 31, 2013 · Viewed 12.9k times · Source

'org.apache.cxf.tools.wsdlto.WSDLToJava' converts wsdl to java classes.

Is it using JAXB internally?How come this command is able to generate classes like how 'xjc' creates?Can somebody explain me how it works?

Answer

Sandeep picture Sandeep · Feb 4, 2013

CXF uses xjc internally for code generation.

Refer to following for more information (from CXF official page)

In CXF versions prior to 2.3.0, the xjc plugins were shaded directly into the big cxf bundle jar. In 2.3.0, they were removed from the jar and are placed individually into the lib directory of the distribution. The xjc plugins are only code generation utilities and not used at all at runtime which is why they were pulled out.

The Apache CXF XJC-Utils subproject provides a bunch of utilities for working with JAXB to generate better or more usable code.

Currently, it consists of the following modules:

cxf-xjc-plugin   Provides a maven wrapper around the JAXB XJC utility
cxf-xjc-dv   Initialize fields mapped from elements/attributes with their default values
cxf-xjc-ts   Implements the toString() method
cxf-xjc-boolean  Generate getters named getXXX() for Booleans instead of isXXX()
cxf-xjc-wsdlextension    Adds extensions methods to allow generated beans to be used as WSDL4J extensors
cxf-xjc-bug671   Provides a workaround for https://jaxb.dev.java.net/issues/show_bug.cgi?id=671
- Not needed for JAXB >=2.1.12