Data Format Description Language (DFDL) message modeling In Websphere Message Broke

This article shows you how to use the new DFDL support in WebSphere Message Broker V8 to model, create, run, and test messages in both Text and Comma Separated Value (CSV) formats.

Share:

Sandipan Chakraborty (sandicha@in.ibm.com), IT Specialist, IBM Global Business Services, IBM

Photo of Sandipan Chakraborty Sandipan Chakraborty is an IT Specialist with IBM Global Business Services in India. He is an engineering graduate with 11 years of IT experience, seven of them with IBM integration technologies. His main focus area is architecting, designing, and developing integration solutions involving WebSphere Message Broker. You can contact Sandipan at sandicha@in.ibm.com.



08 May 2013

Introduction

DFDL is a XML-based standard that you can use to define the structure of formatted data independently from the data format itself. The following new function in IBM® WebSphere® Message Broker V8 (hereafter called Message Broker) enables you to create, run, and test DFDL models:

  • DFDL Parser and domain
  • DFDL Schema Creation Wizards
  • DFDL Schema Editor to model text and binary data formats
  • DFDL Test Perspective to test your DFDL schema files

Creating a DFDL CSV message model

Here is some sample CSV data with a header record, several detail records, but no trailer record. Each row is delimited by newline, and fields within each row are delimited by commas:

EMP_NM, EMP_ID, EMP_DEPT
Sandi, 1234, ABC
John, 0987, JPQ
Elex, 7834, MNO

Here are the steps to creating a DFDL CSV message model:

  1. Create a library named DFDLModelLib, right click-on it, and select New => Message Model:
    Figure 1
    Figure 1
  2. Select CSV text and click Next:
    Figure 2
    Figure 2
  3. Choose how you want to create your message model. Select option one, which creates a DFDL schema with the default element name (you can change it later). Click Next:
    Figure 3
    Figure 3
  4. Provide the details as shown below. Create the CSV folder in DFDLModelLib, and then click Next:
    Figure 4
    Figure 4
  5. Provide details about the number of fields in the CSV message that is being modeled -- in this case three. Select First Record Is Header, and select End of record character to specify that each record is separated by newline. Click Finish:
    Figure 5
    Figure 5
  6. Here is the modeled CSV message. You can edit the Header or Record field name -- as shown below, the Header field name has been changed to EMP_NM:
    Figure 6
    Figure 6

Testing the DFDL CSV message model

In a Message Broker V8 DFDL message model, you can immediately test and validate a message model with sample data:

  1. Click on Test Parse Model:
    Figure 7
    Figure 7
  2. Provide the path of the sample CSV file and click OK:
    Figure 8
    Figure 8
  3. The sample CSV file was successfully parsed by the DFDL CSV parser:
    Figure 9
    Figure 9

Creating a DFDL Text (TDS) message model

Here is some sample Text (TDS) data. It is comma separated, and it uses h*, b*, and t* as initiator for header, body, and trailer records respectively. The body data is in bold, along with the initiator "Add[" and the terminator "]":

h*head_val1,head_value2,head_value3
b*body_value1,Add[Add1,Add2],body_value3
t*trailer_value1,trailer_value2,trail_value3
  1. Right-click on DFDLModelLib and select New => Message Model.
  2. On the Message Model screen, select Record-Oriented text and click Next:
    Figure 10
    Figure 10
  3. Choose how you want to create your Text message model. Select option one, which creates a DFDL schema with the default element name (you can change if later), and then click Next:
    Figure 11
    Figure 11
  4. Provide the details as shown below. Create the Text folder in DFDLModelLib, and then click Next:
    Figure 12
    Figure 12
  5. This screen defines initiators for the header, body, and trailer; the field separators (commas in this case), and the number of fields in the header, body and trailer. When done, click Next:
    Figure 13
    Figure 13
  6. Here is the modeled text message:
    Figure 14
    Figure 14
  7. You still need to modify the message model to accommodate the highlighted text in the body ( Add [Add1, Add2] ). To model the highlighted text, click on Type for body_elem2, select Anonymous, and then add the local elements add_elem1 and add_elem2. Also provide the initiator and terminator details for body_elem2 shown below:
    Figure 15
    Figure 15

Testing the DFDL Text (TDS) message model

  1. Click Test Parse Model and provide the file path for the sample text data:
    Figure 16
    Figure 16
  2. The sample Text file was successfully parsed by the DFDL Parser:
    Figure 17
    Figure 17

Conclusion

Websphere Message Broker V8 now enables you to model, parse, and test DFDL message models. You can develop and test model definitions in the WebSphere Message Broker Toolkit without deploying to a running broker instance. The DFDL Parser provides an efficient and open-standards-based way to access, parse, and transform data in many different formats, with a focus on text and binary data.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=929004
ArticleTitle=Data Format Description Language (DFDL) message modeling In Websphere Message Broke
publish-date=05082013