Accessing complex types through XML facade

The advantage of using XML facade is to provide the ability to access the XML content via Java classes and methods. This recipe explains how to access the complex types through XML facade.

Getting ready

To complete the recipe, we will amend the example BPEL process from the Invoking XML facade from BPEL processes recipe.

How to do it...

The steps involved in accessing the complex types through XML façade are as follows:

  1. Open the Banking_BPEL process and double-click on the XML_facade_node Java Embedding activity.
  2. We amend the code snippet with the following code to access the complex type:
    java.util.List<org.packt.cashflow.facade.PrincipalExchange> princEx= cf.getPrincipalExchange();
  3. We receive a list of principal exchange cash flows that contain various data.

How it works...

In the previous example, we receive a list of cash flows. The corresponding XML content definition states:

<xsd:complexType name="PrincipalExchange">
  <xsd:sequence>
  </xsd:sequence>
  <xsd:attribute name="id" type="xsd:int"/>
</xsd:complexType>    

We can conclude that each of the principle exchange cash flows is modeled as an individual Java class.

Note

Depending on the hierarchy level of the complex type, it is modeled either as a Java class or as a Java class member. Complex types are organized in the Java object hierarchy according to the XML schema definition. Mostly, complex types can be modeled as a Java class and at the same time as a member of an other Java class.

See also

We can now access XML complex types through XML facade. To learn how to access simple types over XML facade, refer to our next recipe, Accessing simple types through XML facade.

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

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