Labs SEI >

Table of Contents


Create a file adapter

  1. Drag the file adapter component into the SCA assembly.
  2. screenshot
  3. Click next for the first window of the Adapter Configuration Wizard.
  4. Choose as ServiceName ReadParametersFileService and click next.
  5. screenshot
  6. Choose define from operation and schema (specified later)
  7. screenshot
  8. Choose the read operation type. Name the operation as Read
  9. screenshot
  10. Define as input directory: /tmp/input.
  11. Define as archive directory: /tmp/archive
  12. screenshot
  13. Choose as include file names patterns: *.csv
  14. screenshot
  15. Change the polling frequency from 1 minute to 10 seconds.
  16. screenshot
  17. Click the button Define Schema for Native format
  18. screenshot

Create schema for the input files

  1. Click next on the Native format builder wizard welcome screen.
  2. Select to create a new schema for delimited space files.
  3. screenshot
  4. Select as sample file this file: input.csv
  5. screenshot
  6. Indicate that the sample file has multiple records of a single type
  7. screenshot
  8. Name line for the name to represent a record
  9. screenshot
  10. Accept the default delimiters.
  11. Select the checkbox which indicates to use the first record as field names
  12. screenshot
  13. Accept the default schema file name. Click the test button and observe the result.
  14. screenshot
  15. Click the finish button

Finish the adapter Configuration wizard

  1. On the adapter configuration wizard, the URL for the created schema file should be specified.
  2. screenshot
  3. Finish the adapter configuration wizard

Create a BPEL process

  1. Create a new BPEL process by dragging BPEL component to the composite view.
  2. screenshot
  3. Name the process as StoreValuesProcess. Choose version 1.1. Choose template for One Way BPEL process. Disable the Expose as Web Service checkbox. Choose the lab2_input_1.xsd as input
  4. screenshot
  5. Connect the ReadParameter shape to the new BPEL process.
  6. screenshot
  7. Open the new BPEL process and delete the current connection
  8. screenshot
  9. Connect the ReadParametersFileService to the receiveInputShape
  10. screenshot
  11. Change the input variable type by double->clicking on the variable field. 'Edit Variable'
  12. screenshot
  13. Change the type of the variable to {ReadParameterFileService}Read_msg
  14. screenshot screenshot

Test file service

  1. Deploy the ServiceChangeOrderProcess
  2. Open browser: http://localhost:7001/em
  3. In the ServiceChangeOrder process check the ReadParametersFileService.
  4. screenshot
  5. Notice the properties tab
  6. screenshot
  7. Test the deployed process copying a .cvs file to the incoming folder (do not forget to create the directories and check the permissions)
  8. Check the new instance.
  9. screenshot

Interact with a DB

The goal of this section is to demonstrate how to interact with relational databases.

Prepare the DB

First, make sure that the database has been configured as described in VM - Configure database.

Open the Oracle DB console, and use the sqlplus utility for managing the database using the console. This is an alternative to using the apex web interface described below. You can learn more about sqlplus here. Using the console is also useful for quickly recreating database tables and insert test data.

You can pipe a script containing multiple commands to the sqlplus program:

sqlplus soa_user/welcome1 < script

Create a Database Connection

  1. Drag the Database Adapter component to the partner link layer
  2. screenshot
  3. Name the Adapter service name as Lab2DBConnection
  4. screenshot
  5. Use the created DB connection, e.g.: eis/DB/mydb
    This name must match the DBAdapter data pool name configured in the Oracle WebLogic Server Administration Console (http://localhost:7001/console)
  6. screenshot
  7. Choose to only insert elements in the table:
  8. screenshot
  9. Choose the lab2 table:
  10. screenshot
  11. Choose the first column for primary key:
  12. screenshot
  13. Finish adapter configuration wizard.

Write to a JDBC DB

  1. Observe the WSDL created by the service adapter.
  2. Create a new variable of the type Lab2Collection_msg. Name the variable as var_multiple_lines.
  3. screenshot
  4. Drag a transform shape and a invoke shape to after the receive input component.
  5. screenshot
  6. Open the transform shape and use inputVariable as the source and multiple_lines as the target variable. Name the mapper file as xsl/transform_to_multiple.xsl
  7. screenshot
  8. In the multiple_lines.xsl graphical editor. Line the desired variables.
  9. screenshot
  10. Edit the invoke component so that its partner link is Lab2DBConnection. It is an insert operation and the input is the multiple lines variable.
  11. screenshot
  12. Deploy the process and test the results. First place a csv file in the input directory. Then, await for the process to consume it. Finally, connect to database and check the table contents
    • sqlplus soa_user/welcome1
    • SELECT * FROM lab2;