Showing posts with label File Adapter. Show all posts
Showing posts with label File Adapter. Show all posts

Friday, January 9, 2015

#372 File Adapter Valves --> convert xlsx to csv

Simple scenario here - I need to process an excel .xlsx file in SOA Suite.

This was very straightforward, as Mark Foster from the A-Team has detailed the steps for doing this, albeit with BPM. He details exactly how to implement the file adapter valve, leveraging Apache POI for the xlsx to csv conversion.

Check out his post here

Btw. I am using JDev SOA Suite 12c Quickstart.

I just followed Mark's instructions and then copied the valve implementation jar to the following directories -













and










I re-started the integrated server.

My composite is as follows -
















The BPEL process does nothing, except accept in the payload.

I deploy and test -

Here is the sample .xlsx file from Mark -










Here is the audit trail from the BPEL instance -


















Java project for xlsx conversion here

SOA project there

Again, a big thank you to Mark!


Thursday, January 8, 2015

#369 UMS Email adapter (part 2)--> send PDF file as an email attachment

Simple scenario -

Read in a pdf file and send it as a pdf attachment.









fileService_4 configuration -














































































The strategy I am using here, is not to read the contents, so I get the file and
directory names from the header. These I copy into process variables -


















This information will be used in a function to
add the file as an attachment to the email.

I will be using the ora:readFile function -
e.g. ora:readFile('file:///c:/docs/My.pdf'')

I need to swap the "\" to "/" in the directory variable.
I then create a variable with the value'file:///c:/docs/My.pdf''






I then set the attachment values on the EmailPDF activity as follows -








I deploy and test -

For testing purposes, I will drop the BAM pdf into the input directory.










The email arrives with the attachment -














I open the pdf -











#368 UMS Email adapter --> send file as an an attachment part 1

Simple Scenario -


























































Here is the Assign from the BPEL process -










Here is the SendEmail config -











































Deploy and test -

Here is my input file -




















My input directory is -



















Test - copy the myFile.txt to the input directory -

Check for the email -



















Tuesday, January 6, 2015

#367 File Adapter --> use of Trigger File

Simple scenario -

D:\BBB\inTrigger is my directory for incoming orders - 1 order per file.
I do not want to start processing the orders until all have been received.
This will be signaled by the arrival of a file called end.txt.

Here is my composite -







Here is the config of the readOrders adapter -


















I test with 2 input orders ans the end.txt file -
The result is 2 composite instances and 2 orders written -


































Monday, January 5, 2015

#365 FileAdapter --> dynamically setting the outbound file name

Scenario 1 -

set the file name to XXX_timestamp




































results in the creation of the file -






Scenario 2 -

set the file name to nn_nn_timestamp.xml

nn_nn will be set to custLastName-product















I set the filename dynamically in the BPEL process as follows -

I edit the Invoke activity -




























Deploy and Test











Check the output file -






















#364 Fixed Length file processing part 2

Here we receive a fixed length text file of type A and
write it to a fixed length text file of type B

Type A -







AccountNr 8 chars
First Name 10 chars
Surname 10 chars
CountryCode 2 chars

Type B -







AccountNr 12 chars
First Name 15 chars
Surname 15 chars
CountryCode 2 chars

Create a composite and and add a File Adapter (Read),using the schema builder, as per the previous post.

Add a file write adapter using the schema builder, based on the file of type B.

















Deploy and test -




















outB_7.txt and outB_8.txt are my two output files, and, as you can see,
they adhere to the FixedLengthTextFile2.txt format.

All I needed to add to the nXSD generated for FormatB was the padding instruction -

nxsd:padStyle="tail"



















#363 Fixed Length File processing with SOA Suite 12c

Here is a simple example -

My flat file is as follows -










AccountNr (8 chars)
First name (10 chars)
Surname (10 chars)
CountryCode (2 chars)

I create an empty soa composite in JDev 12c and add a file adapter -















































































I set the field positions as follows -










Now I can set the field names and types -












































looks good!























I click the Test button (bottom right)























I now add a File adapter(Write) to the composite.
I added a new schema to the project, this will be used by the WriteCustomer2File.
This simply writes each customer record to a file.
















I will hardcode the status value in the following BPEL process Assign activity.

I add a BPEL process that will receive in my file and invoke the file adapter(Write)





I deploy and test -

I see 2 output files, 1 per customer -