Synchronous Read Operation of File Adapter in SOA Suite 12C

In my previous example I have explained about the polling operation of file adapter. Now I am going to give you an example of a�?Synchronous Read Filea�� operation of file adapter in BPEL process. Synchronous read means polling will depend on the input variables. This is on demand polling service. In this example file directory and file name will be the variables and data will be inserted into database from file. Follow the below steps to complete this example.

  1. Create a SOA Project. Right click on application -> New -> Project. Select SOA project and Enter name a�?SyncReadFilea��Synchronous_Read_File_1 Synchronous_Read_File_2 Synchronous_Read_File_3
  2. Select composite type as a�?Composite with BPELa��Synchronous_Read_File_4
  3. Click on a�?Finisha�� and a�?BPEL processa�� wizard will open. Enter BPEL process name and select BPEL template type as a�?Synchronous BPEL Processa��Synchronous_Read_File_5
  4. Click on a�?OKa�� and BPEL composite will open.Synchronous_Read_File_6
  5. Drag a File Adapter from Component (BPEL Services -> File) and drop it in the right swim lane of the BPEL process.Synchronous_Read_File_7
  6. a�?File Adapter Configurationa�� wizard will open. Enter reference nameSynchronous_Read_File_8
  7. Configure file adapter as mentioned in the previous example. Only change the operation type of file adapter as a�?Synchronous Read Filea��Synchronous_Read_File_9
  8. Check the previous example and proceed further with the configuration of the file adapter.Synchronous_Read_File_10
  9. Now create two variables (file directory and file name) in BPEL Process.A�Click on a�?Variablesa�� icon in the main scope.Synchronous_Read_File_11
  10. Click on green plus signSynchronous_Read_File_12
  11. Enter variable name and select type of the variable (string type).Synchronous_Read_File_13 Synchronous_Read_File_14 Synchronous_Read_File_15
  12. Now variable window will look like thisSynchronous_Read_File_16
  13. Drag and drop a�?Assigna�� activity between receiveInput and replyOutputSynchronous_Read_File_17
  14. Now assign value to both the variables. Right click on fileDir and select ExpressionSynchronous_Read_File_18
  15. Write expressions for both variables as mentioned in the below screenshot. Expression can be created in the a�?Expression Buildera�� also. Select substring from String Functions and select a�?Insert Into Expressiona��. Then insert input payload and then last-index-within-string from String Functions.Synchronous_Read_File_19 Synchronous_Read_File_20
  16. Now a�?Editor assigna�� window will be like this.Synchronous_Read_File_21
  17. Drag and drop a�?Invokea�� activity after Assign activity and connect the wire between Invoke activity and ‘InputFile’ partner link (File adapter).Synchronous_Read_File_22
  18. a�?Invoke Editora�� window will open. Enter proper name of the Invoke activity and create input and output variable by clicking the green plus sign.Synchronous_Read_File_23 Synchronous_Read_File_24 Synchronous_Read_File_25
  19. Click on OK and Invoke window will look like this.Synchronous_Read_File_26
  20. Go to the property tab in the Invoke window and assign the variables to the value of the properties as shown in the below screenshot.Synchronous_Read_File_27
  21. Click on a�?OKa�� and BPEL will be like thisSynchronous_Read_File_28
  22. Drag and drop database adapter in the right swim lane. Go to BPEL Services -> DatabaseSynchronous_Read_File_29
  23. a�?Database Adapter configurationa�� wizard will open. Refer my previous article a�?Select operation on Database Adaptera�� for the configuration of Database Adapter. Select database connection, JNDI connection and operation type as a�?Insert Onlya�?.Synchronous_Read_File_30
  24. Drag and drop an a�?Invokea�? activity after the first Invoke activity which is connected to the file adapterSynchronous_Read_File_31
  25. Enter name of the Invoke activity and create input and output variables.Synchronous_Read_File_32 Synchronous_Read_File_33
  26. If Database Adapter partner link moves to the left swim lane then move it to the right swim lane. Right click on DB partner link and select Display -> Move to Opposite Swim LaneSynchronous_Read_File_34
  27. Drag and drop a a�?Transformationa�? activity in between two Invoke activities.Synchronous_Read_File_35
  28. Double click on Transformation activity and select a�?Sourcea�? and a�?Targeta�? variableSynchronous_Read_File_36
  29. Source will be the output from the invoke activity of the file adapter and Target will be the input of the invoke activity of Database adapter.Synchronous_Read_File_37 Synchronous_Read_File_38
  30. Click on a�?OKa�� and transformation file will open. Do the mapping between source and target items.Synchronous_Read_File_39
  31. Now set a confirmation message to the output variable of the BPEL process
  32. Drag and drop an a�?Assigna�� activity after the second Invoke activity and set a message to the output payload in the assign activity.Synchronous_Read_File_40
  33. BPEL Process will beA�like this.Synchronous_Read_File_41
  34. Deploy the project in the server and test the project in the Enterprise Manager Console.
  35. Keep the file in the location that is mentioned in the below screenshot and that will be the input to the application.Synchronous_Read_File_42
  36. Click on a�?Test Web Servicea�� and output message will displaySynchronous_Read_File_43
  37. Check the table in databaseSynchronous_Read_File_44
  38. All the data in the file has populated in the table.

Issue ofA�Invoke activityA�of this SOA application:

Here I am going to share my issue while creating this project. I have faced one issue at the time of a�?Invokea�� activity. Output tab was disabled like the below screenshot.Invoke_activity_output_tab_disable_1

Solution:

Here is the solution detail approach with steps below:

1.Add a property in xml format in .jca file of database adapter.

2.Add output message in the WSDL.

Check the below screenshots for the solution.Invoke_activity_output_tab_disable_2 Invoke_activity_output_tab_disable_3

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here