It is possible to include the definitions of schema elements into WSDL. To overcome the extraction of XML schema content from the WSDL document, we would rather take the WSDL document and create XML facade for it. This recipe explains how to create XML facade out of the WSDL document.
To complete the recipe, we need the WSDL document with the XML schema definition. Luckily, we already have one automatically generated WSDL document, which we received during the Banking_BPEL project creation.
We will amend the already created project, so it is recommended to complete the Generating XML facade using ANT recipe before continuing with this recipe.
Here are the steps involved in creating XML façade from WSDL:
build.xml
) in JDeveloper.<property name="wsdl_file" location="../Banking_BPEL/Derivative_Cashflow.wsdl"/>
<target name="xjc_wsdl"> <delete dir="src/org"/> <mkdir dir="src/org"/> <echo message="Compiling the schema..." /> <exec executable="xjc"> <arg value="-wsdl"/> <arg value="${schema_file}"/> <arg value="-d"/> <arg value="${dest_dir}"/> <arg value="-p"/> <arg value="${package}"/> </exec> </target>
build.xml
file in the Projects pane. Then, we select the xjc_wsdl task in the Structure pane of JDeveloper, right-click on it, and select Run Target "xjc_wsdl":The generation of Java representation classes from WSDL content works similar to the generation of Java classes from XSD content. Only the source of the XML input content is different from the xjc
utility.
In case we execute the ANT task with the wrong XML or WSDL content, we receive a kind notification from the xjc
utility. For example, if we run the utility xjc
with the parameter –xmlschema
over the WSDL document, we get a warning that we should use different parameters for generating XML façade from WSDL.
Now that the Java presentation of XML content is created, it is time to create a JAR (Java Archive) package for the BPEL process and provide documentation for our XML facade. The mentioned two tasks are covered in the following two corresponding recipes: Packaging XML facade into JAR and Generating Java documents for XML facade.