First create a csv file in excel and save it in csv format.
Create a SOA application -> SampleCSVApp and a SOA project inside it CSVTest
Drop a FileAdapter from Component Palette and give a name like WriteCSV select the write operation Type.
Next step select the output Directory and give a file name.
In next step select the native format builder by clicking the icon next to search icon
Select delimited option
Now here in this step you will browse the .csv file that we have created earlier
Select the datatypes of the column and give element name
Check use the first record as the field names and select next now you will see a xsd is generated with specified type and name.
You can test it by clicking on Test and finish.
Now create a one way bpel process and in input parameter select the same sample xsd element.
Now use a transform activity to send input data to file.
The generated file will not have header names details in it.if you want to add the header name details in generated csv file .for the the generated xsd file need to be modified and these attributes need to be added into the xsd as shown below
nxsd:hasHeader="true"
nxsd:headerLines="1"
nxsd:outboundHeader="Name,EmpID,DeptID ${eol}"
nxsd:headerLinesTerminatedBy="${eol}"
nxsd:hasHeader="true"
nxsd:headerLines="1"
nxsd:outboundHeader="Name,EmpID,DeptID ${eol}"
nxsd:headerLinesTerminatedBy="${eol}"
Deploy it and test it...!
No comments:
Post a Comment