Java Reference
In-Depth Information
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* Java class for CreditCard complex type. Comments ommitted.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CreditCard", propOrder = {
"cardNumber",
"name",
"expirationDate"
})
public class CreditCard {
@XmlElement(required = true)
protected String cardNumber;
@XmlElement(required = true)
protected Name name;
@XmlElement(required = true, nillable = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar expirationDate;
//getters and setters for each field ommitted.
The generated type for the Authorization looks similar. The XML annotations allow you to
marshal an instance of this type back into XML using JAXB on the client side if you want to
work with a SAAJ XML view. But you can treat it like a regular Java class on the server side,
and on the client side as well if you use a proxy.
Notice that the type as represented in Java has “forgotten” all of the constraints you placed on
the element in the schema. A Java proxy will let you populate these fields regardless of those
constraints.
For the sake of completeness, let's now look at the build file to see how all these items are
packaged.
Build file
Here is the build file that puts all of these pieces together and deploys it to Glassfish:
<project name="soacookbookServer" default="all">
<property file="soacookbookServer.properties"/>
Search WWH ::




Custom Search