Java™ class requirements
The generated Java™ classes must be serializable. The @XmlRootElement element must be specified in the Java™ classes that represent the schema.
You can use the URL location (-U command)
to read and write Java objects only when your objects are serializable.
To generate serializable objects, specify
<serializable
uid="1"/>
in a bindings file under <globalBindings>
and
pass it to the XJC binding compiler with the -b option.
For example: xjc -b bindings.xjb
The -C adapter
command points to the root class. You can annotate your root class
with the @XmlRootElement
, or the XJC binding compiler
can do it for you. To use the XJC binding compiler to annotate the
root class, add <xjc:simple/>
to your bindings
file under <globalBindings>
. Pass the bindings
file to the XJC binding compiler by using the -b option.
An
example bindings file follows:
<?xml version="1.0" encoding="UTF-8"?> <bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" version="2.1"> <globalBindings> <serializable uid="1" /> <xjc:simple/> </globalBindings> </bindings>
The XJC binding compiler produces Java files (.java) from the schema. You manually package the
Java files into Java Archive (JAR) files. You must modify the CLASSPATH environment variable
for all Java-based adapters that rely on external JAR files. You can edit the CLASSPATH
directly, or you can add the JAR files to the config.yaml configuration
file. Add JAR file entries to the /runtime/External Jar Files
dictionary of the config.yaml file and specify the full path to the JAR
file. For example:
External Jar Files:
jar1: “c:/J2EE/lib/j2ee.jar”
jar2: “c:/mypath/myjar.jar”