bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

File Plug-In

An Example of Using the File Plug-In

This section provides an example of how to use the File Plug-In to transfer a file to a remote server via FTP. The first part of the example tells you how to set up a workflow in the WebLogic Integration Studio to FTP a file when the workflow is executed. The second part of the example tells you how to use the JSP Worklist to start the workflow, resulting in the transfer of a text file.

Note: This example uses the WebLogic Integration Samples Domain. For more information, see "Configuring and Starting the Samples Domain" in Starting, Stopping, and Customizing BEA WebLogic Integration.

Setting Up the Workflow

To set up a workflow in Studio to FTP a file, complete the following steps:

Note: For more information about using WebLogic Integration Studio, see Learning to Use BEA WebLogic Integration at http://e-docs.bea.com/wli/docs70/bpmtutor/index.htm.

1. Start the WebLogic Integration server.

   - On Windows, choose Start—>Programs—>BEA WebLogic Platform 7.0—>WebLogic—>Integration Examples—>Start Server.

   - On UNIX, run BEA_HOME/weblogic700/samples/integration/config/samples/startWebLogic.sh.

   In the preceding line, BEA_HOME represents the WebLogic Platform home directory.

2. After the server is running, open the WebLogic Integration Studio:

   - On Windows, choose Start—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Studio.

   - On UNIX, run:

   >     BEA_HOME/weblogic700/integration/bin/studio.sh

3. Log on to the WebLogic Integration Studio with the following parameters: (See Figure 2-1.)

   - User Name: joe

   - Password: password

   - Server URL: t3://localhost:7001

   Figure 2-1 Logon to WebLogic Integration Studio

4. After WebLogic Integration Studio opens, select CDExpress from the Organization drop-down list.

5. Right-click the Templates node and select Create Template. The Template Properties window opens, as shown in Figure 2-2.

   Figure 2-2 Template Properties Window

6. On the General tab, in the Name field, enter "FTP Example" and then click OK.

7. In the Organization tree, right-click the FTP Example Template node, and then select Create Template Definition.

8. In the Template Definition FTP Example window, click OK.The Workflow Design window opens in the right pane, as shown in Figure 2-3.

   Figure 2-3 Workflow Design - FTP Example

9. Right-click Task 1 and select Properties. The Task Properties window opens, as shown in Figure 2-4.

   Figure 2-4 Task Properties Window

10. Make sure the Activated tab is selected. (This is the run-time state.)

11. Click Add. The Add Action window opens, as shown in Figure 2-5.

    Figure 2-5 Add Action Window

12. Open the FilePlugin Actions folder, select Read a File Content to a Variable, and then click OK. The Read a File window opens, as shown in Figure 2-6.

    Figure 2-6 Read a File Window

13. Set the Read a File actions as follows:

    - File Name: "d:\\put\\test.txt" (enter full path including quotes)

    - File Type: text

    - Variable Name: My Variable

    Note: Use two backslashes for Window systems.

14. In the Task Properties window, select the Executed tab, and then click Add. The Add Action dialog box opens.

15. Open the FilePlugin Actions folder, select the File Transfer (FTP) node, and then click OK. The File Transfer window opens, as shown in Figure 2-7.

    Figure 2-7 File Transfer Window

16. Set the File Transfer actions as follows:

    - Transfer Action: put.

    - Transfer Mode: binary.

    - FTP Server Name: "Name of your FTP server" including quotes.

    - Remote File Name: "c:\\receive\\gettest.txt" including quotes.

    - Local File Name "d:\\put\\test.txt" including quotes.

    - User Name: The name needed to log on to your FTP server.

    - Password: The password needed to log on to your FTP server.

17. In the Task Properties window, select File Transfer (FTP), click the Up arrow, and then click OK. See Figure 2-8.

    Figure 2-8 Task Properties - Move File Transfer Task

18. In the Organization tree, right-click the Variables Node, and then select Create Variable. The Variable Properties window opens, as shown in Figure 2-9.

    Figure 2-9 Variable Properties

19. Set the variable properties as follows:

    - Name: My Variable

    - Type: String

    - Parameter: Input

20. Right-click the Template Definition Folder and select Properties.

21. Select the Active check box and click OK.

22. Right-click the Template folder and select Save.

    Note: An asterisk by the folder indicates that the changes have not been saved.

23. In your file system, create a text file corresponding to the Local File Name you created in the File Transfer window.

Activating the Workflow

In this part of the example, the JSP Worklist executes the workflow, resulting in the transfer of the text file to the remote file system.

For more information about the JSP Worklist, see Using the WebLogic Integration JSP Worklist.

1. To start the JSP Worklist, do one of the following:

   - On a Windows system, choose Start—>Programs—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Worklist.

   - On a UNIX system, open a browser and enter the following URL:

   >     http://localhost:7001/worklist

The Login page displays, as shown in Figure 2-10.

Figure 2-10 Login to WebLogic Integration JSP Worklist

1. Enter joe in the User Name field.

2. Enter password in the Password field.

3. Click the OK button. The JSP Worklist displays, as shown in Figure 2-10.

   Figure 2-11 JSP Worklist Main Page

4. Select CDExpress from the Organization drop-list.

5. Click Start Workflow. The Start Workflow page opens, as shown in Figure 2-12.

   Figure 2-12 Start Workflow Page

6. In Select Workflow to Start list, select FTP Example, and then click OK. The Worklist opens showing the task, as shown in Figure 2-13.

   Figure 2-13 Worklist with New Task

7. Click Execute. The file is transferred to its target directory and the task disappears from the worklist.

8. Check your target directory to see the transferred file.