![]() |
![]() |
|
|
Using MsgDefAdmin
The MsgDefAdmin Tool is a command line utility that allows the definition of a message format to be specified in an XML language called Message Format Language (MFL). Using your favorite text or XML editor, you can specify fields and the grouping of fields, according to the Message Format Language Document Type Definition (mfl.dtd). This XML document can then be imported using the MsgDefAdmin Tool to define the message format and all components (fields, controls, and formats).
The tasks involved in creating formats using MsgDefAdmin are as follows:
Creating an MFL Document
An MFL document is a description of a message that is sent to an application. To create an MFL document, you need to translate messages into a textual description that conforms to the MFL document type definition (mfl.dtd). The file mfl.dtd defines the elements and attributes necessary to create message formats.
To create an MFL document, follow the steps below. A sample MFL document is shown in Listing 3-2 following these steps.
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM `mfl.dtd'>
Note: These two lines must always be the first two lines of your MFL document.
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM `mfl.dtd'>
<MessageFormat name='message_name'>
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM `mfl.dtd'>
<MessageFormat name='message_name'>
<FieldFormat name='field_name'
type='type_attribute'/>
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM `mfl.dtd'>
<MessageFormat name=message_name>
<FieldFormat name='field_name'
type='type_attribute'/>
<StructFormat name='structure_format_name'
repeatField="repeating_field_name">
Note: Refer to Message Format Elements for a list of the elements you can include in an MFL document and their descriptions.
Listing 3-1 Sample MFL Document
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM `mfl.dtd'>
<MessageFormat name='PAYROLL_MSG'>
<FieldFormat name='NUM_EMPLOYEES' type='LittleEndian4'/>
<StructFormat name='EMPLOYEE_REC'
repeatField="NUM_EMPLOYEES">
<FieldFormat name='EMPLOYEE_NAME' type='String'
delim='\xFF'/>
<FieldFormat name='EMPLOYEE_SSN' type='String'
length='11'/>
<FieldFormat name='EMPLOYEE_PAY' type='Upacked'
length='15'/>
</StructFormat>
</MessageFormat>
Message Format Elements
This section lists the message format elements that make up the MFL document and provides a description of each element.
Note: In the examples below, the following characters have special meaning:
</MessageFormat>
[{repeat="99" repeatField="xxx"
repeatDelim="xxx"}]
[alternative="yes/no"]
[optional="yes/no"]>
</StructFormat>
[basetype="xxx" cutoff="99"]
[length="99" delim="xxx"]
[optional="yes/no"]
[accessMode="Normal/Current/Next/
Controlling/Relative/Increment"]
[value="xxx"]>
</FieldFormat>
yy < cutoff --> 20yy
[length="99"]
</LenField>
Notes: The TagField and LenField elements must be child elements of a FieldFormat element. The order in which they appear in the FieldFormat element determines the order of the data in the message.
The same StructFormat element may not be defined in two different message definitions. If this happens, when these message definitions are imported, the StructFormat is redefined by the second message definition, leaving the first message definition in an invalid state. For example, suppose message definition A and message definition B both contain a structure called PAY_TABLE. When message definition A is imported, the import creates a format called PAY_TABLE. When message definition B is imported, the PAY_TABLE format is redefined. Message definition A then contains a reference to a format that no longer exists. When you try to access message definition A, you now receive an error.
Running MsgDefAdmin
To add message definitions created using an MFL file to the Information Integrator database, follow the steps below.
Note: Do not run the MsgDefAdmin utility and the Formatter GUI concurrently if they are connected to the same database.
Listing 3-2 MsgDefAdmin
- Copyright (c) 2000 BEA Systems, Inc.
All Rights Reserved.
Distributed under license by BEA Systems, Inc.
BEA eLink Information Integrator is a registered trademark.
This product includes software developed by the Apache Software Foundation (http://www.apache.org/).
- - - BEA eLink Information Integrator 1.1 - - -
- - - Message Definition Importer Tool - - -
Enter choice:
1) Add Message Definition
2) Get Message Definition
3) Delete Message Definition
4) List Message Definitions
Q) Quit >
You can also run MsgDefAdmin in a non-interactive mode. There are two command-line options that allow you to import or export message definitions.
The command-line syntax is as follows:
MsgDefAdmin [-i | -e] <XML filename>
where
Processing file: payroll.xml
Message Definition created!
Processing file: employee_data.xml
Message Definition created!
Processing file: purchase_order.xml
Message Definition created!
XML Document retrieved:
Created file PAYROLL_MSG.xml
ML Document retrieved:
Created file EMPLOYEE.xml
Example
This section outlines the procedure required to complete Step 3 in Using Information Integrator. In Step 3, you create the message format definitions. We need to define the layout of our data as a linear buffer. Since our input is actually an FML32 buffer, Information Integrator will map the data from FML to a linear buffer as defined by the input message format. This is done using MsgDefAdmin to create an XML file. We have provided two XML files for you to use in this example. You can use these files as a base for creating your own XML files to solve your own business needs.
In the steps that follow, we will view and discuss the XML files for this payroll example, and use MsgDefAdmin to create the message format definitions.
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM 'mfl.dtd'>
MessageFormat name="II_payroll_msg1">
<FieldFormat name="NAME" type="String"/>
<FieldFormat name="EMPNO" type="BigEndian4"/>
<FieldFormat name="$RPAYDATE" type="BigEndian2"/>
<StructFormat name="II_payroll_msg1_rep" repeatField="$RPAYDATE">
<FieldFormat name="PAYDATE" type="String" accessMode="Controlling"/>
<FieldFormat name="RATE" type="String"/>
<FieldFormat name="HOURS" type="String"/>
</StructFormat>
</MessageFormat>
This file creates the input format for the data.
When you have finished viewing the first XML file, close it.
<?xml version='1.0'?>
<!DOCTYPE MessageFormat SYSTEM 'mfl.dtd'>
<MessageFormat name="II_payroll_msg2">
<FieldFormat name="EMPNO" type="String"/>
<FieldFormat name="$RPAYDATE" type="String"/>
<StructFormat name="II_payroll_msg2_rep" repeatField="$RPAYDATE">
<FieldFormat name="PAYDATE" type="String" accessMode="Controlling"/>
<FieldFormat name="PAY" type="String" controlName="CALC_PAY"/>
</StructFormat>
</MessageFormat>
This file creates the output format for the data.
When you have finished viewing this file, close it.
From a command prompt, in the directory where you installed Information Integrator, type the following:
msgdefadmin -i \sample\payroll\II_payroll_msg1.xml
and press Enter. MsgDefAdmin processes the first XML file and displays a message when finished.
msgdefadmin -i \sample\payroll\II_payroll_msg2.xml
and press Enter. MsgDefAdmin processes the XML file and displays a message when finished.
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|