Using encoders to parse CSV files in OpenESB

This screencast provides a simple example of encoding a multi-line CSV file into XML as part of a Glassfish ESB application.

The JBI framework underlying Open ESB, Glassfish ESB, and Java CAPS requires XML msgs to move between the service units. Custom Encoders provide a means to encode/decode structured data to/from XSD defined documents. Encoders are then applied to payloads as the pass through Binding Components on their way in/out of the framework.

This example was plagiarised reused from an example by Sebastien. It shows a multi-line CSV file generated from an OpenOffice spreadsheet. A custom encoder is then created to translate it into a well-defined XML file when it picked up by the File BC. The encoder is enhanced to remove quote marks that are added by OpenOffice to string values when saving as CSV.

The Open ESB wiki has more information about Encoders and examples.

Screencast (11mins)


Comments:

hi jason,

perfect and cool example of what is possible in the new 6.x CAPS.
just a question. for "us" as legacy users comming from repo based eGate / ICAN / CAPS 5.1.X it is very difficult to understand all capeabilities that the "new style CAPS" is able to do. do you know if there is any / will be any training course from sun that gives legacy users as we are an overview how to program in the "new paradigms".

regards chris

Posted by Christian Brennsteiner on March 04, 2009 at 04:37 AM CET #

Hi christian,

There is a "CAPS6 for CAPS5 users" course:
http://www.sun.com/training/catalog/courses/CAPS-0600.xml
I see now that its not offered in EMEA yet. I´ll see if I can find out for you.

In some countries in europe we have been running CAPS6 bootcamp courses. The agenda is similar to the GlassfishESB bootcamp:
http://blogs.sun.com/jason/entry/openesb_training_in_oslo
plus:
- JBI Bridge
- JCA adaptors
- MDM

rgds
Jason

Posted by Jason on March 04, 2009 at 04:47 AM CET #

Hi Jason,

do you know if there is a way inside the encoder to skip the first line of the csv that by default contains the fieldnames?

Thanks for the post.

Kris

Posted by Kris on March 10, 2009 at 05:55 AM CET #

Hi Kris,

I know it has been requested as a feature but I´m not sure if its been implemented yet. You should ping users@openesb.

rgds
Jason

Posted by jason on March 12, 2009 at 01:43 AM CET #

Hi Jason,
Is there any way I can skip ',' in csv within quotes, if i m using ',' as delimiter to parse the csv.
Thanks,
Hrishi

Posted by guest on August 07, 2009 at 01:03 AM CEST #

good post

Posted by gucci shoes on February 10, 2010 at 02:42 AM CET #

Post a Comment:
Comments are closed for this entry.
About

jason

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today