The following tutorial illustrates the usage of the file adapter as a service component.
1. In the Applications Navigator, click New Application. Another option is to use the File->New... menu option to create a new application.
2. In the Create Application dialog box, specify an Application Name (FileAdapterAsServiceComponentApp).
3. Leave the Application Package Prefix field empty. In the Application Templates choose the SOA Application and click Next.
4. In the Project Name field enter a project name (FileAdapterAsServiceComponentProj). In the Composite Template select Empty Composite and click Finish.
5. From the Component Palette select the File Adapter Service Adapter and drag it on the Exposed Services
6. On the Welcome to the Adapter Configuration Wizard, click Next.
7. On the Service Name screen, specify a service name (ReadFileService).
8. On the Adapter Interface, select the Define from operation and schema (specify later) radio button for the Interface option and click Next.
9. On the Operation screen, select the Read File Operation Type option and click Next.
10. On the File Directories screen, specify a directory for the Incoming Files (/home/oracle/tmp/in). If you would like to archive the processed files, then specify an archive location (/home/oracle/tmp/archive) and click Next.
11. On the File Filtering screen, specify any name patterns that you would like to filter (*.xml) and click Next.
12. On the File Polling screen, specify the polling frequency (10 seconds) and the minimum file age (5 seconds) and click Next.
13. On the Messages screen, specify the schema of your files. For this tutorial, I am using an xml schema (note.xsd) and xml file (note.xml) from w3schools. So click the flash light next to the URL text box to browse to the note.xsd. Because I did not import the schema file in my project, click on the Import Schema File ... and browse to the note.xsd. Select the option Copy to Project and click OK.
14. On the Localize Files window just click OK.
15. Now on the Type Chooser, expand Project Schema Files, note.xsd and select the node element and click OK.
16. You should see now on the Messages screen the URL field is populated with the xsd/note.xsd value and the Schema Element set to note (this is our root element). Click Next and then Finish.
17. On the composite.xml you should see now the ReadFileService on the Exposed Services swim lane.
18. From the Component Palette drag a BPEL Process Service Component on the Components swim lane.
19. On the Create BPEL Process window, specify a name (BPELProcess1), a template (Synchronous BPEL Process). Deselect the option Expose as a SOAP Service and click OK.
20. From the Component Palette, drag a Mediator Service Component on the Components swim lane.
21. On the Mediator Component window, specify a name (Mediator1) and from the Template select Define Interface later and click OK.
22. From the composite.xml, drag a wire from the ReadFileService to the Mediator.
23. From the composite.xml, drag a wire from the Mediator to the BPELProcess1.
24. Double click the BPELProcess1 to open it with the BPEL editor.
25. Drag an Assign BPEL Activity between the receiveInput and replyOutput activities.
26. Create a Copy Operation assigning the input variable to the output variable and click OK.
27. From the composite.xml, double click the Mediator1 to open the Mediator1.mplan file.
28. Click on the Select an existing mapper file or create a new one option next to the Transform Using.
29. On the Request Transformation Map, select the Create New Mapper File and click OK.
30. From the mapper file (note_To_process.xsl), map one of the note elements (from) to the input element of BPELProcess1.
31. Click save and on the Save Warning click Save All
32. Deploy your project to your soa domain.
33. Place the note.xml in your input directory. The file adapter will pick it up, initiate the BPEL Process, copying the from element value to the BPEL’s input variable. The BPEL process will then copy the input variable to the output variable and reply back with the value.
Download: File Adapter as a Service Component