In OSB, we can use Message Format Language(MFL) to transform binary data to XML and vice versa.
We use format builder to create mfl files and can't create mfl files from sbconsole. We would be required Jdevloper to create MFLs.
Let's take a use case. We have a binary data in the below format
Ankur|Jain
Rishab|Jain
and want to convert into XML
<?xml version="1.0" encoding="UTF-8"?>
<Employees>
<Employee>
<FirstName>Ankur</FirstName>
<LastName>Jain</LastName>
</Employee>
<Employee>
<FirstName>Rishab</FirstName>
<LastName>Jain</LastName>
</Employee>
</Employees>
Let's start with an example, and see how it works.
Assuming we do have a Service Bus application with Service Bus project.
1) Right Click on Service Bus project -> New -> MFL
2) Give MFL name and click Finish
3) MFL Format Builder will get open automatically, if not you can write click on the MFL and click Open with Format Builder
4) Click on EmployeeMFL element from the left navigation and you can rename it and click Apply
5) Click on Insert -> Group -> As Child
6) Enter Name as Employees, Select Unlimited(means we can have multiple Employees element) from the Group occurrence section, Click Apply
7) Click on Employee element, Select Insert -> Filed -> As Child
8) Enter Name as FirstName, select Delimiter from the Field Attributes section, enter Value(s) as | symbol, select Code page as UTF-8 and click Apply button
9) Click on Employees element again and, Select Insert -> Filed -> As Child
10) Enter Name as LastName, select Delimiter from the Field Attributes section, enter Value(s) as
\n symbol, select Code page as UTF-8 and click Apply button
MFL is done. Now it's time to test the MFL. Jdevloper provides the inbuilt tool to test the MFL.
10) Click on Tools -> Test from the MFL Format Builder wizard
11) Select Text from the down Tab, Enter the Non-XML data in the left panel, Click on Transform-> Non-XML To XML
And see the result
Note: You can generate the sample file by clicking on the Generate -> Non-XML
That's it !!
We use format builder to create mfl files and can't create mfl files from sbconsole. We would be required Jdevloper to create MFLs.
Let's take a use case. We have a binary data in the below format
Ankur|Jain
Rishab|Jain
and want to convert into XML
<?xml version="1.0" encoding="UTF-8"?>
<Employees>
<Employee>
<FirstName>Ankur</FirstName>
<LastName>Jain</LastName>
</Employee>
<Employee>
<FirstName>Rishab</FirstName>
<LastName>Jain</LastName>
</Employee>
</Employees>
Let's start with an example, and see how it works.
Assuming we do have a Service Bus application with Service Bus project.
1) Right Click on Service Bus project -> New -> MFL
2) Give MFL name and click Finish
3) MFL Format Builder will get open automatically, if not you can write click on the MFL and click Open with Format Builder
4) Click on EmployeeMFL element from the left navigation and you can rename it and click Apply
5) Click on Insert -> Group -> As Child
6) Enter Name as Employees, Select Unlimited(means we can have multiple Employees element) from the Group occurrence section, Click Apply
7) Click on Employee element, Select Insert -> Filed -> As Child
8) Enter Name as FirstName, select Delimiter from the Field Attributes section, enter Value(s) as | symbol, select Code page as UTF-8 and click Apply button
9) Click on Employees element again and, Select Insert -> Filed -> As Child
10) Enter Name as LastName, select Delimiter from the Field Attributes section, enter Value(s) as
\n symbol, select Code page as UTF-8 and click Apply button
MFL is done. Now it's time to test the MFL. Jdevloper provides the inbuilt tool to test the MFL.
10) Click on Tools -> Test from the MFL Format Builder wizard
11) Select Text from the down Tab, Enter the Non-XML data in the left panel, Click on Transform-> Non-XML To XML
And see the result
Note: You can generate the sample file by clicking on the Generate -> Non-XML
That's it !!
Tidak ada komentar:
Posting Komentar