With OSB you can easy transform a formatted flat file to a xml. To do this in OSB you have to create a MFL and XQuery definition. MFL is the output of the Format Builder tool where you can create descriptions of non XML files. XQuery can use the output of MFL to generate the xml.
This is an example of the flat file
10;0123456789;MR;JOHN;SMITH
20;0123456789;ACCT1
30;0123456789;SALARY;500000
30;0123456789;BONUS;1000
20;0123456789;ACCT2
30;0123456789;OTHER;100
10;1234566790;MR;DAVID;DOE
20;1234567890;ACCT1
30;1234567890;SALARY;10000
And this is the record definition of the flat file
one block is made of:
one record 10 (customer)
1 to N record 20 per record 10 (accounts)
1 to N record 30 per record 20 (transactions)
record 10
customer id
customer lastname
customer firstname
record 20
customer id
account id
record 30
customer id
label
value
Create a new MFL in the Oracle Workshop for Weblogic ( Eclipse plugin )

First we add group 10 ( customer ) as child of the main element. Then we define the fields of recordtype 10. As child group of customer we add the Account group etc.
Here is a picture of the customer group where I enabled that the group is tagged option, with as value 10; and the group occurence is unlimited.




I made a new xml schema with I can use as target in Xquery. This is the xsd




Create a new proxy service with messaging as service type. As Request message type we have to use the just created MFL.






Create Business Service from workshop, select service as messaging service, message type as xml [do not use browse button leave it empty],select transport as jms or file , if jms then select endpoint uri , next tab jmstransport configuration destination type queue and type as text.
now call this business service from proxy routing service.
Note: When you test proxy service please use payload from mfl test editor go to file save as data file ( whatever flat file works for you on test editor) save that file as data file and then browse that file as payload. Copy paste may end of some transformation error.
hope you enjoy it.

No comments:
Post a Comment