Friday, April 9, 2010

FTP Adapter As A Service Component

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 (FtpAdapterAsServiceComponentApp).

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 (FtpAdapterAsServiceComponentProj). In the Composite Template select Empty Composite and click Finish.

5. From the Component Palette select the FTP 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 FTP Server Connection, specify the jndi connection name (I will create it later) as eis/Ftp/MyDemoFtpAdapter.

10. On the Operation screen, leave the File Type as Ascii, and select the Get File Operation Type option and click Next.

11. On the File Directories screen, specify a directory for the Incoming Files (/home/oracle/in). If you would like to archive the processed files, then specify an archive location (/home/oracle/archive) and click Next.

12. On the File Filtering screen, specify any name patterns that you would like to filter (*.xml) and click Next.

13. On the File Polling screen, specify the polling frequency (10 seconds) and the minimum file age (5 seconds) and click Next.

14. 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.

15. On the Localize Files window just click OK.

16. Now on the Type Chooser, expand Project Schema Files, note.xsd and select the node element and click OK.

17. 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.

18. On the composite.xml you should see now the ReadFileService on the Exposed Services swim lane.

19. From the Component Palette drag a BPEL Process Service Component on the Components swim lane.

20. 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.

21. From the Component Palette, drag a Mediator Service Component on the Components swim lane.

22. On the Mediator Component window, specify a name (Mediator1) and from the Template select Define Interface later and click OK.

23. From the composite.xml, drag a wire from the ReadFileService to the Mediator.

24. From the composite.xml, drag a wire from the Mediator to the BPELProcess1.

25. Double click the BPELProcess1 to open it with the BPEL editor.

26. Drag an Assign BPEL Activity between the receiveInput and replyOutput activities.

27. Create a Copy Operation assigning the input variable to the output variable and click OK.

28. From the composite.xml, double click the Mediator1 to open the Mediator1.mplan file.

29. Click on the Select an existing mapper file or create a new one option next to the Transform Using.

30. On the Request Transformation Map, select the Create New Mapper File and click OK.

31. From the mapper file (note_To_process.xsl), map one of the note elements (from) to the input element of BPELProcess1.

32. Click save and on the Save Warning click Save All

33. Before deploying the composite, you must create the Outbound Connection Pool for the ftp adapter that we have created. So go to your weblogic console (http://domain:port/console and login as weblogic.

34. Click Deployments from the domain structure and from the deploments table, select FtpAdapter.

35. Select the Configurations tab and in the Outbound Connection Pool Configuration Table click New.

36. On the Outbound Connection Groups, select javax.resource.cci.ConnectionFactory and click Next.

37. Specify a JNDI Name (for example, eis/Ftp/MyDemoFtpAdapter) and click Finish.

38. Click the Security tab (next to Configuration) and click New in the Credential Mappings table.

39. Select your Outbound Connection Pool (eis/Ftp/MyDemoFtpAdapter) and click Next.

40. On the WebLogic Server User screen, select the Configured User Name radion button and in the WebLogic Server User Name input field, enter your weblogic username (weblogic) and click Next.

41. On the EIS User Name and Password screen, enter your operating system user and password that you want to connect using FTP (please note that I am using Oracle Red Hat Linux 5 with vsftpd. I am not connecting using the root user but another user that i have created named oracle). Click Finish.

42. Deploy your project to your soa domain.

43. 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.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete