bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Translating Data

Introduction to Data Translation

In most enterprise application integration (EAI) problem domains, data translation is an inherent part of an EAI solution. XML is quickly becoming the standard for exchanging information between applications; it is invaluable in integrating disparate applications. Most data transformation engines, however, do not support translations between binary data formats and XML. WebLogic Integration enables applications to exchange information by supporting data translations between the binary formats used on legacy systems and XML.

This section provides information about the following topics:

- Understanding XML Translation

- What Is Data Integration?

- Post-Translation Options and Considerations

Understanding XML Translation

Data that is sent to or received from legacy applications is often platform-specific information organized in a binary format unique to the machine on which the information originated. Binary data is not self-describing, so in order to be understood by an application, information about the format of this data (metadata) must be embedded within each application that uses binary data from a legacy application.

XML is becoming the standard for exchanging information between applications because XML embeds a description of the data within the data stream, facilitating the exchange of data among applications. Although XML can represent complex data structures, it is easily parsed. As a result, the coupling of applications no longer depends on the embedding of metadata.

Binary-to-XML translation is the conversion of structured binary data to an XML document so that the data can be accessed via standard XML parsing methods. You must create the metadata used to perform the conversion. During the translation process, each field of binary data is converted to XML according to the metadata defined for that field. The metadata you specify must include the name of the field, the data type, the size, and an indication of whether the field is always present or optional. This description of the binary data is used to translate the data to XML. Figure 1-1 shows how a sample piece of binary data is translated into XML.

Figure 1-1 XML Data Translation of: Tom;Jones;1345;19;

Applications developed on a WebLogic Server platform often use XML as the standard data format. If you want the data from your legacy system to be accessible to other applications on a WebLogic Server platform, you may use WebLogic Integration to translate that data from binary to XML format, or from XML to binary format. If you need the data to be converted to a particular XML dialect for end use, you must transform it using an XML data-mapping tool.

What Is Data Integration?

WebLogic Integration facilitates the integration of data from diverse enterprise applications by supporting the translation of binary legacy system data to XML and vice versa. Once legacy data is available as XML, it can be consumed directly by XML applications, transformed into a specific XML grammar, or used directly to start workflows in the WebLogic Integration Studio. WebLogic Integration supports non XML-to-XML translation and vice versa through the use of three data integration tools:

- Design-Time Component

- Run-Time Component

- Plug-In to Business Process Management

A translation is a two-step process. First, create a description of your binary data using Format Builder, the design-time tool. This task involves analyzing binary data so that the layout of records in the binary file is accurately reflected in the metadata you create in Format Builder.

Next, you create metadata (a description of the input data) in Format Builder and save this metadata as a Message Format Language (MFL) document. WebLogic Integration provides importers, utilities that automatically create message format definitions from common sources of binary metadata, such as COBOL copybooks.

You can then use the run-time component in WebLogic Integration to translate instances of binary data to XML. Figure 1-2 shows the event flow for non XML-to-XML data translation. A plug-in to BPM functionality simplifies the task of configuring translations.

Figure 1-2 Event Flow for Translating Data from NonXML to XML Format

Design-Time Component

The design-time data integration component of WebLogic Integration is a Java application called Format Builder. Format Builder is used to create descriptions of binary data records. It allows you to describe the layout and hierarchy of the binary data so that it can be translated to or from XML.

You can describe sequences of bytes as fields and specify, for each field, the type of data (floating point, string, and so on), the size of the data, and the name of the field. You can further define sets of fields (groups), multiple instances of fields and groups, and aggregation.

The description you create is saved in an XML grammar called Message Format Language (MFL). MFL documents contain metadata used by the data integration run-time component and the plug-in to business process management to translate an instance of a binary data record to an instance of an XML document (or vice versa).

Format Builder also creates a DTD or XML Schema document that describes the XML document created from a translation.

Figure 1-4 shows the process flow of binary and XML data through Format Builder during the design-time phase.

Figure 1-3 Design-Time Process Flow Through Format Builder

You can also use Format Builder to retrieve, validate, and edit stored MFL documents and to test message format definitions with your own data. MFL documents may be stored using the file system or archived in the repository.

The test feature allows you to verify the MFL documents created in Format Builder by translating a sample XML file to binary format, or translating a sample binary file to XML format. You can save the transformed data in a file for future testing.

Run-Time Component

The run-time data integration component of WebLogic Integration is a Java class with various methods that are used to translate data between binary and XML formats. This Java class can be used in several ways. Specifically, it can be:

- Deployed in an EJB using WebLogic Server

- Invoked as a business operation from a workflow in the Studio

- Integrated into any Java application

Figure 1-4 shows the run-time process flow for both binary-to-XML translations and XML-to-binary translations.

Figure 1-4 Run-Time Process Flow

Binary-to-XML Translation

The sample code in Listing 1-1 shows the parsing of a file containing binary data into an XML document object. The MFL file mymfl.mfl provides a description of the binary data in mybinaryfile.

Listing 1-1 Sample Code for Binary-to-XML Translation

>     import com.bea.wlxt.*;
>     import org.w3.dom.Document;
>     import java.io.FileInputStream;
>     import java.net.URL;

>     try
>     {
>       WLXT wlxt = new WLXT();
>       URL mflDocumentName = new URL("file:mymfl.mfl");
>       FileInputStream in = new FileInputStream("mybinaryfile");

>       Document doc = wlxt.parse(mflDocumentName, in, null);
>     }
>     catch (Exception e)
>     {
>       e.printStackTrace(System.err);
>     }

XML-to-Binary Translation

The sample code in Listing 1-2 shows the translation of the XML data in myxml.xml to the binary format specified by the MFL document mymfl.mfl. The binary data is written to the file mybinaryfile.

Listing 1-2 Sample Code for XML-to-Binary Translation

>     import com.bea.wlxt.*;
>     import java.io.FileInputStream;
>     import java.io.FileOutputStream;
>     import java.net.URL;

>     try
>     {
>       WLXT wlxt = new WLXT();
>       URL mflDocumentName = new URL("file:mymfl.mfl");
>       FileInputStream in = new FileInputStream("myxml.xml");
>       FileOutputStream out = new FileOutputStream("mybinaryfile");
>       wlxt.serialize(mflDocumentName, in, out, null);
>     }
>     catch (Exception e)
>     {
>       e.printStackTrace(System.err);
>     }

Plug-In to Business Process Management

The business process management (BPM) tools provided by WebLogic Integration enable you to automate workflows, business-to-business processes, and enterprise application assembly. Designed to run on WebLogic Server, the BPM tools provide a robust J2EE standards-based workflow and process integration solution.

Using an intuitive flowchart paradigm, business analysts use the WebLogic Integration process engine, underlying the BPM tools, to define business processes that span applications or to automate human interaction with applications. Developers can use the process engine to assemble application components and then to execute and manage them, without having to write new code.

The process engine has an extensible architecture that allows new functionality to be plugged in. WebLogic Integration includes a data integration plug-in that allows you to access translation capabilities (both XML-to-binary and binary-to-XML) through a BPM action.

The data integration plug-in for business process management (BPM) functionality supports an exchange of information between applications by making it possible to translate binary data from legacy systems into XML. The data integration plug-in provides BPM actions that allow you to perform XML-to-binary and binary-to-XML translations.

In addition to this data translation capability, the data integration plug-in provides:

- Event data processing in binary format

- In-memory caching of MFL documents and translation object pooling to boost performance

- A BinaryData variable type to edit and display binary data

- Execution within a clustered WebLogic Server environment.

The following figure describes the relationship between data integration and BPM functionality.

Figure 1-5 Data Integration and BPM Relationship

Post-Translation Options and Considerations

After you have successfully translated your binary data to XML, the XML data can be sent to other applications that consume XML, such as the business process management (BPM) client applications (the Studio and the Worklist). Depending on the requirements of the target application, the XML generated may require further transformation; this time, to a different XML grammar, to a display format (HTML), or to another binary format. In this document we refer to the process of transforming an XML document from one XML grammar to another as XML transformation.

XML transformation can be accomplished via the XML module of WebLogic Server. The BPM functions include an action that allows you to access this module and transform XML documents using XSL stylesheets. You might want to transform XML to any one of several formats:

- A specific XML dialect (such as RosettaNet or ebXML)

- A display format (HTML)

- A format that matches that of another MFL document and can be converted to a different binary format by the data integration component of WebLogic Integration

The eXtensible Stylesheet Language (XSL) is an XML language that describes a series of transformations that can be performed on nodes of an XML document. An XSL stylesheet is an XSL document that can be used by an XSL Transformation (XSLT) engine to map an XML document to another XML dialect or to another text format (such as HTML or PDF). A stylesheet can also be used with the data translation run-time component of WebLogic Integration to transform XML.

Figure 1-6 shows how one XML grammar is converted to another, using an XSLT engine. The transformation metadata in this case is an XSL stylesheet that describes how one XML grammar is mapped onto another.

Figure 1-6 XML Data Transformation of: Tom;Jones,1345;19