Skip Headers
Oracle® SOA Suite Developer's Guide
10g (10.1.3.1.0)

Part Number B28764-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

8.5 Importing an XML Schema into the Data Model with Rule Author

Before defining the rules that specify conditions for a BPEL Decide Activity to evaluate using rules, you must define an Oracle Business Rules data model. A data model contains business data definitions for facts or data objects used in rules, including XML facts that are based on an XML schema.

For example, the SOA Order Booking application includes the OrderBookingRules.xsd file. This file specifies the schema for the customer information that the Decision Service sends as facts to the rules engine, and that the rules engine processes to determine if manual approval is required for an order. Oracle Business Rules binds an XML schema to Java classes using Java Architecture for XML Binding (JAXB). For details on using custom binding declarations, see Java Architecture for XML Binding (JAXB) Specification,

http://java.sun.com/webservices/jaxb/index.jsp

8.5.1 How to Import XML Schema into the Data Model

You need to process the XML schema and import the processed XML schema elements into the data model so that you can use the business objects when you define the business rules.

8.5.1.1 Performing XML Schema Processing

Before you can use XML elements in a data model, Rule Author must generate the classes representing the XML elements found in the XML schema. This step generates the JAXB classes and makes the generated classes and packages associated with the XML schema visible to Rule Author.

To use Rule Author to prepare a schema:

  1. If necessary, load the dictionary by clicking the Repository tab.

  2. Click the Definitions tab. The navigation tree shows the Definitions folder that contains the available definitions.

  3. The Definitions folder in the tree contains the facts folder, which includes the available fact types: JavaFact, XMLFact, and RLFact. You use a JavaFact to work with business objects based on Java classes. A Java fact type allows selected properties and methods of a Java class to be declared so that rules can access, create, modify, and delete instances of the Java class. You use an RLFact to work with Oracle Business Rules RL Language fact. An RL Language fact contains a list of members of either RL Language fact type, Java fact type, or primitive type. RL Language fact types can be used to extend a business model by providing virtual dynamic types that are available when the rules engine runs.

    Click XMLFact to view the XML Fact Summary page (see Figure 8-6). An XML fact type allows selected attributes and subelements of an XML element or complexType to be declared so that instances of it can be accessed, created, modified, and deleted by rules. For example, this is the type that you use to define the business objects in the SOA Order Booking application.

    Figure 8-6 Rule Author Definitions XML Fact Summary Page

    Rule Author Definitions XML Fact Summary Page
    Description of "Figure 8-6 Rule Author Definitions XML Fact Summary Page"

  4. Click Create.

    Rule Author shows the XML Schema Selector page.

  5. On the XML Schema Selector page, in the XML Schema field, enter either the path or HTTP URL for the schema. For example, you could use either of the following:

    • C:/demo/OrderBookingRules.xsd

    • http://www.myCompany.com/xsd/product.xsd

  6. In the JAXB Class Directory field, enter the directory where you want Rule Author to store the JAXB-generated classes (the directory that you specify must be writable). For example, enter:

    c:/demo/xml
    
    
  7. Enter a value for the Target Package Name field. If you leave this field empty, the JAXB classes package name is generated from the target namespace of the XML schema using the default JAXB XML-to-Java mapping rule. For example, the namespace rules.oracle.com is mapped to com.oracle.rules.

    The value you enter specifies the generated classes package name. For example, generated. Although this example uses the name generated, there is nothing special about the name generated. This value specifies the package name for the JAXB-generated classes (see Figure 8-7).

    Figure 8-7 Rule Author XML Schema Selection Page

    Rule Author XML Schema Selection Page
    Description of "Figure 8-7 Rule Author XML Schema Selection Page"

  8. Click Add Schema.

    Rule Author processes the schema and compiles the JAXB, so depending on the size of the schema, you may need to wait for this step to complete. When this step completes, the page shows the cleared Add Schema text entry fields and Rule Author updates the Current XML Schemas field and shows the Generated JAXB Classes box (see Figure 8-8).

    Figure 8-8 Rule Author Definitions XML Schema Selector After Adding XML Schema

    Rule Author Definitions XML Schema Selector
    Description of "Figure 8-8 Rule Author Definitions XML Schema Selector After Adding XML Schema"

8.5.1.2 Importing XML Schema Elements into the Data Model

This step brings the JAXB-generated classes representing the XML schema elements into the data model (from the sample schema OrderBookingRules.xsd).

To import the schema representing the data required to build the rules and to output results:

  1. Click the Definitions tab to view the Definitions page.

  2. Click the XMLFact folder in the navigation tree.

  3. Click Create on the XML Fact Summary page. This shows the XML Schema Selector page.

  4. In the Generated JAXB Classes box on the XML Schema Selector page, expand the navigation tree until you see ApproveType, Approve, and ObjectFactory.

  5. Select the generated folder check box.

  6. Click Import.

    Rule Author shows a confirmation message: "1 class or package has been imported" (see Figure 8-9).

  7. Expand the Generated node in the Generated JAXB Classes box to see the imported classes.


    Note:

    After an element is imported, the element is shown in bold.

    Figure 8-9 Rule Author XML Schema Selector with Confirmation Message

    Rule Author XML Schema Selector with confirmation
    Description of "Figure 8-9 Rule Author XML Schema Selector with Confirmation Message"

8.5.1.3 Saving the Dictionary

While you work on a data model from the Definitions tab and when you complete your work, it is important to save the dictionary.

To save a dictionary:

  1. Click the Save Dictionary link at the top of the Rule Author page.

  2. Click Save on the Save Dictionary page.

8.5.2 What Happens When You Import XML Schema into the Business Model

When you import XML schema into the data model, Rule Author updates the data model to include the types and elements you imported. This allows Rule Author to present these elements and types in the lists you see when you use Rule Author to create and modify rules.

When you save a dictionary, Rule Author stores the rules and the data model associated with the dictionary using the specified version name.

8.5.3 What You May Need to Know When You Import XML Schema

If you choose to access the XML schema with a URL, and a proxy server is involved, then you must set the following system properties:

proxyHost = $YourProxyHost
proxyPort = $YourProxyPort
proxySet = true

For example:

-DproxyHost=www-proxy.myCompany.com -DproxyPort=80 -DproxySet=true

For more information about setting system properties in an OC4J instance, see Oracle Containers for J2EE Configuration and Administration Guide.