This recipe explains how to prepare a package containing XML facade to be used in BPEL processes and in Java applications in general.
To complete this recipe, we need the XML facade created out of the XML schema. Also, the generated Java classes need to be compiled.
The steps involved for packaging XML façade into JAR are as follows:
In this chapter, we also cover the building of XML facade with the ANT tool. To support an automatic build process, we can also define an ANT target to build the JAR file. We open the build.xml
file and define a new target for packaging purposes. With this target, we first recreate the deploy directory and then prepare the package to be utilized in the BPEL process:
<target name="pack" depends="compile"> <delete dir="deploy"/> <mkdir dir="deploy"/> <jar destfile="deploy/CFacade.jar" basedir="./classes" excludes="**/*data*" /> </target>
To automate the process even further, we define the target to copy generated JAR files to the location of the BPEL process. Usually, this means copying the JAR files to the SCA-INF/lib
directory:
<target name="copyLib" depends="pack"> <copy file="deploy/CFacade.jar" todir="../Banking_BPEL/SCA-INF/lib"/> </target>
The task depends on the successful creation of a JAR package, and when the JAR package is created, it is copied over to the BPEL process library folder.
Besides the generation, implementation, and packaging of XML facade, it is also a good habit to provide the documentation. This is especially helpful, when the designers of XML facade and the BPEL process are two different developers. To learn how to prepare the Java documents for XML facade, refer to the next recipe—Generating Java documents for XML facade.