Creating XML facade from XSD

This recipe describes how to create XML facade classes from XSD. Usually, the necessity to access XML content out of Java classes comes from already defined XML schemas in BPEL processes.

How to do it...

We have already defined the BPEL process and the XML schema (Derivative_Cashflow.xsd) in the project. The following steps will show you how to create the XML facade from the XML schema:

  1. Select the CashflowFacade project, right-click on it, and select New. Select JAXB 2.0 Content Model from XML Schema.
    How to do it...
  2. Select the schema file from the Banking_BPEL project. Select the Package Name for Generated Classes checkbox and click on the OK button.
    How to do it...

The corresponding Java classes for the XML schema were generated.

How it works...

Now compare the classes generated via the ANT utility in the Generating XML facade using ANT recipe with this one. In essence, the generated files are the same. However, we see the additional file jaxb.properties, which holds the configuration of the JAXB factory used for the generation of Java classes.

It is recommended to create the same access class (Facade.java) in order to simplify further access to XML facade.

See also

To explore how to build up XML facade from the WSDL document, refer to the Creating XML facade from WSDL recipe.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset