The WebLogic Integration software includes a purchase order sample designed to illustrate the basic techniques of creating and testing message format definitions for non-XML data using Format Builder. The purchase order sample consists of MFL and DATA files. This sample can be used to learn more about using non-XML data in WebLogic Integration and to test your installation of the non-XML mapping functionality of WebLogic Integration.
The following topics are discussed in this section:
To learn more about using non-XML data in WebLogic Integration and the using the Format Builder for creating and testing message format definitions, see Guide to Data Transformation.
For additional information about the Format Builder, see the help included with the Format Builder executable. (To access the Format Builder help, start the Format Builder as described in Step 1. Start the Format Builder and Create a Message Format and then from the Format Builder menu bar, choose Help —> Help Topics.)
The following table describes the files provided with the purchase order sample application. All directory names are relative to the WebLogic Integration samples directory (WLP_HOME\integration\samples\di) where WLP_HOME is the top-level directory of your WebLogic Platform installation. (For example, if you installed WebLogic Platform in the c:\bea directory, the di directory is located at the following path: c:\bea\weblogic81\integration\samples\di.)
To understand how the Format Builder is used, it helps to understand the data formats used by the data integration tools provided by WebLogic Integration: non-XML data, XML, and MFL. If you have not already done so, please review Supported Data Types section of the Format Builder help. (To access the Format Builder help, start the Format Builder as described in Step 1. Start the Format Builder and Create a Message Format and then from the Format Builder menu bar, choose Help —> Help Topics.)
The following sections provide information about building a sample purchase order format definition and testing the transformation of non-XML data into XML format:
You can build format definitions that provide the information required to transform non-XML data to or from XML. Format definitions are the metadata used to parse the content of a non-XML data file.
The key to translating non-XML data to and from XML is to create an accurate description of the non-XML data. For non-XML data (data that is not self-describing), you must identify the following elements:
The following listing shows sample non-XML data that is included with WebLogic Integration in the WLP_HOME\integration\samples\di\po\po_01.data file, where WLP_HOME is the top-level directory of your WebLogic Platform installation. (For example, if you installed WebLogic Platform in the c:\bea directory, the po directory is located at the following path: c:\bea\weblogic81\integration\samples\di\po.)
In this sample, the data is taken from a fictitious purchase order on a proprietary system used by the XYZ Corporation. XYZ wants to exchange information with another system that accepts XML data.
1234;88844321;SUP:21Sprockley's Sprockets01/15/2000123 Main St.; Austin;TX;75222;555 State St.;Austin;TX;75222;PO12345678; 666123;150;Red Sprocket;
To analyze the purchase order data:
A field is a sequence of bytes that is meaningful to an application. For example, in Table 2-2, Purchase Request Number, Supplier ID, Supplier Name, and so forth, are all fields.
Field attributes include the name of the field, the type of data stored in the field, the length of the field, and the delimiter that indicates the end of the field. For example, the Supplier ID field is delimited by a semicolon (;) indicating the end of the field data, but the Requested Delivery Date has an implied length of 10 characters.
Groups are collections of fields, comments, and other groups or references that are related in some way. In Table 2-1, notice that the sample data defines a number of distinct groups: Shipping Address, Billing Address, Payment Terms, and Purchase Items.
You must define the attributes of the hierarchical groups. Group attributes include the name of the group, whether the group is optional, repeating, or delimited, or whether it is defined as a reference to another group. For example, because the same fields are required to define both a Shipping Address and a Billing Address (Street, City, State, Zip), you can define an Address group within the Shipping_Address group and set up a reference to it from within the Billing_Address group.
After you complete the preceding procedure, you may want to put the data into a spreadsheet, as shown in the example in Figure: Analysis of Purchase Order Data. This spreadsheet can then serve as a guide when you create your purchase order message definition.
Figure : Analysis of Purchase Order Data
This section walks you through the process of creating a message format for translating the non-XML data to XML. To make sure you create your purchase order message format correctly, you can compare the file you create with the WLP_HOME\integration\samples\di\po\po.mfl file included with WebLogic Integration, where WLP_HOME is the top-level directory of your WebLogic Platform installation. (For example, if you installed WebLogic Platform in the c:\bea directory, the po directory is located at the following path: c:\bea\weblogic81\integration\samples\di\po.)
To start Format Builder and create a message format:
The Format Builder main window is displayed.
A new message format root node is created and displayed in the navigation tree.
To create the fields required to capture the basic identifying information for the purchase order:
A new field is added to the navigation tree (left pane). The default field properties are displayed in the detail window (right pane).
Note: To learn more about the check-boxes and fields in the detail window (right pane), select the F1 key. A browser is displayed with a description of the check-boxes and fields.
Note: These values are determined by the analysis of the raw purchase order data shown in Figure: Analysis of Purchase Order Data.
The properties of the field are updated.
Note: Because the only difference between the PR_Number field and the Supplier_ID field is the name you can use the Format Builder Duplicate feature to create the Supplier_ID field.
A duplicate field (NewPR_Number) is added as a sibling and becomes the current selection in the navigation tree.
The Save As dialog box is displayed.
Note: The Format Builder automatically assigns the .mfl extension to message format files if no extension is specified.
A new field is added to the navigation tree (left pane). The default field properties are displayed in the detail window.
Select Numeric from the Type drop-down menu on the Description tab. |
|
Verify that the Length check-box is selected, and then enter 2 in the Length text box. |
Note: To learn more about the check-boxes and fields in the detail window (right pane), select the F1 key. A browser is displayed with a description of the check-boxes and fields.
The properties of the field are updated.
Note: The dotted-line box around the field icon in the navigation tree indicates that this field is optional.
A new field is added to the navigation tree. The default field properties are displayed in the detail window.
In the Data Base Type drop-down menu, verify that String is selected. |
Note: The contents of the detail window for a field is determined by the Type setting. When you select a date type from the drop down list, the length is implicitly determined. Therefore, the Field Attributes: Termination properties are no longer displayed.
Note: To learn more about the check-boxes and fields in the detail window (right pane), select the F1 key. A browser is displayed with a description of the check-boxes and fields.
The properties of the field are updated.
To create the shipping address and billing address groups:
A new group is added to the navigation tree. The default group properties are displayed in the detail window.
Verify that the None check-box is selected for Group Delimiter. |
Note: These values are determined by the analysis of the raw purchase order data shown in Figure: Analysis of Purchase Order Data.
Note: To learn more about the check-boxes and fields in the detail window (right pane), select the F1 key. A browser is displayed with a description of the check-boxes and fields.
The properties of the group are updated.
Note: Because the only difference between the Shipping_Address group and the Billing_Address group is the name, you can use the Format Builder Duplicate feature to create the Billing_Address field.
A duplicate group (NewShipping_Address) is added as a sibling and becomes the current selection in the navigation tree.
Because the Shipping_Address and Billing_Address groups contain the same fields with the same attributes, we can define an Address group within the Shipping_Address group and set up the Address group within the Billing_Address group as a reference.
Note: Once the Street field is created, you can use the Duplicate button to create the City and State fields.
The Address group properties (including the child fields) are copied and placed on the clipboard.
The Address reference, is pasted immediately after the Billing_Address group. The arrow in the icon is identifies the group as a reference group:
The Address reference becomes a child of the Billing_Address group.
Repeat the process of creating or duplicating fields and groups as required to complete the purchase order message format document. Use the analysis of the raw purchase order data presented in Figure: Analysis of Purchase Order Data to determine the values you need to enter for each item. For assistance, refer to the WLP_HOME\integration\samples\di\po\po.mfl file, where WLP_HOME is the top-level directory of your WebLogic Platform installation. (For example, if you installed WebLogic Platform in the c:\bea directory, the po directory is located at the following path: c:\bea\weblogic81\integration\samples\di\po.)
When you finish entering the required items, your navigation tree (left pane) should look similar to the one shown in Figure: Completed Navigation Tree for Purchase Order Sample.
Figure : Completed Navigation Tree for Purchase Order Sample
Choose File —> Save to save your completed message format.
To test the message format to identify any errors before using it to transform data:
The non-XML data is displayed in the Non-XML window.
The content of the PO_01.DATA file is transformed to XML based on the active MFL document. The XML output is displayed in the XML window.
Note: To view a description of each transformation step, choose DisplayÆ Debug to open the Debug window, and then choose Transform —> Non-XML To XML. A message is displayed for each step of the process.
You can also use the Format Builder to create message definitions and test the transformation of XML data to non-XML. The steps required to do this are essentially the same as those you follow to transform non-XML data to XML. To transform XML data to non-XML, first create an MFL description for the non-XML format. The purchase order sample files can be used to test the process as described in the following procedure.
The message format document is displayed in the navigation tree.
The XML data is displayed in the right pane.
The XML data is transformed, and the purchase order data is displayed, in non-XML format, in the right pane.
Note: To view a description of each transformation step, choose Display —> Debug to open the Debug window, and then choose Transform —> XML to Non-XML. A message is displayed for each step of the process.