APPS TO FUSION

.......Our Journey from Apps To Fusion

Contributors

BPEL- How to call an APPS API using BPEL and Flat file imports.

User Rating: 5 / 5

Star activeStar activeStar activeStar activeStar active
 

I have had many requests for an example on how to use BPEL to import data into Oracle, this is a common requirement and I thought that instead of just using a table and file, I will use Oracle APPS Api along with BPEL Oracle Apps Partner link for inserting of a Salary Proposal Update.

 

 

Pre-Requisites

You will need SOA suite setup on your machine and a connection to an Oracle Applications Instance, and a working copy of JDeveloper with BPEL 10.1.3.2 will suffice.

Assumptions.

Although this example is explained in as simple terms as possible, it is assumed you understand what BPEL is and basic understanding of Oracle Applications

I have already created a CSV file for this example that we will be using, the file although not perfectly aligned to a normal business process will give you a good idea on how the process works. The file itself contains rows of salary proposal information which we are going to use to run the API.

Step 1 – Create a new workspace in Oracle JDeveloper

· From the file menu click New.

· Select Applications and Select Application under items

· In Application name type, FileImportApplication

· Leave all other defaults

· Click Ok

· Click Cancel on the Create Project Screen

· From Applications Navigator Right click FileImportApplication

· Select New Project

· Under new projects window select BPEL Project

· Type FileUpload for the File name

· Change template to Empty BPEL Process

· Click Finish

We have now created a new application and Empty BPEL project.

We are now going to define a partner link that will read the CSV file from our file system

· If not already selected make sure that you select FileUpload.Bpel, so that the BPEL diagram moddler appears on your screen

· In component panel select services

· Drag and Drop a Partner Link Service to the right hand side of your BPEL diagram

· Once create partner window pops up select Define Adapter Service button(second last button from the right under the WSDL settings section.

· Select File Adapter from the adapter type screen

· Click Next

· In the service name type, PayrolFileReadService

· Click Next

· Select Read File as your Operation type

· Click Next

· Type in c:\temp\ in the directory for incoming files(you can select any folder you like here but just remember that this is where the service will be polling for new files.

· Click Next

· In the include files with Name Pattern type in payrol*.csv

· Click next

· Change polling frequency to 1 second

· Click next

· Click the Define Schema for native format button

· Skip the welcome page and select Delimited under create new native format from the choose type screen.

· Click next

· Under filename select browse and navigate to Payroll.csv file

· Change number of rows to skip to 1.

· Click next

· Select file contains multiple record instances and select multiple records are of single type.

· Click Next

· Type SalaryUpload for enter name of element containing multiple records

· And Salary for enter name for element that will represent one record

· Click Next

· Accept defaults on pg 5 and click next

· Change C1 through to C5 as follows

o C1 = Assignment_Id

o C2 = Business_Group_id

o C3 = Employee_Number

o C4 = Change_Date

o C5 = Change_Percentage

o C6 = Proposal_Reason

· Click Next

· Next

· Finish

· Click next on the Adapter Config page and then finish

You have now created a file listening service

Next we are going to create a receive activity

· Select Process Activities from the component pallet

· Drag and drop a Receive Activity onto you BPEL diagram

· Double click the receive activity

· Type receive File in the Name under general tab

· Select the flashlight next to the partner link field

· Select PayrolFileReadService from the partner links

· Click ok

· Click the create wand next Variable (this will create a default variable for the receive activity

· Click ok

· Make sure you select Create Instance on the receive activity and click ok

· Click file Save ALL

 

We have now create a receive activity to receive the file once picked up

Although not necessary in this scenario , but necessary in most business scenarios I will create a transformation activity.. so that we can transform data types, but first we need to create the Oracle Applications Service Partner

· Click on services in the component palette

· Drag and drop and Oracle Applications Partner link to the right side of your diagram

· Type in SalaryPropasalService in the Name field

· Click Next

· Select a defined apps connection(if one is not showing define one)

· Click Next

· The oracle applications module browser will now popup

· Type %PROPOSAL% and Select API’s and select search( I wrote a wrapper procedure, as the seeded proc contains Boolean values, which are not compatable with BPEL)

· Select Insert Salary Proposal

· Click OK

· Click next

· Click finish

· Click OK

 

 

The service has now been created. We need to now create a invoke method in order to be able to use the invoke method’s variables in the transformation activity.

· Select Process activities

· Drag a invoke activity below your receive activity

· In name type invokeProposalAPI

· Select the flashlight next to the Partner link field and select the salaryproposalapi partner link

· Select the wand next to input variable to generate a variable

· Click Ok

 

 

 

We are now going to create a transformation activity.

· Select Process Activities

· Drag a transform activity to below your receive file activity

· Double click the transform activity

· Click General Tab

· Type TransformDataForAPI for name

· Click transformation

· Select source variable as receiveFile_Read_InputVariable

· Select SalaryUpload as the source part

· Select target variable as invokeProposalAPI_salaryProposal

· Select Input Parameters as the Target Part

· Select the wand next to the transformation mapper file field

· A screen will appear that has source and targets

· Drag and drop the mappings AssignmentID > P_Assignment_Id, and the rest

· In my example I used a concat string function by dragging the function onto the map and then selecting employee-number and change percentage as the input variable

· Right click the map and select test

Ok

 

We have now selected a file from the file system transformed it and called a Apps API. One would still add error handling to this.

Deploy the BPEL File to BPEL Serv

· Right click FIleUpload project

· Select Deploy

· Deploy to default Server

To test this you can copy SalaryUpload.csv file into c:\temp

Comments   

0 #1 Shireen 2008-04-21 12:28
Hi George,

Really a very nice article. Was really looking for such article.

Thank s and Regards,
Shiree n
Quote
0 #2 Shirin 2008-04-28 22:29
Hi,

When i come to the stage of creating a Oracle Applications Partner link, it gives WSDL Write Error and the message is The Wrapper procedure HR_MAINTAIN_PRO POSAL_API$INSE, could not be found in the package XX_BPEL_SalaryP ropasalService for the schema APPS.

My Question is do i need to create a Wrapper before i execute this step and if i need to create what should be available in Wrapper

Apprec aite your help

Thanks.
Shiri n
Quote
0 #3 Debanjan De 2009-02-27 06:25
Hi George,

This is a very nice and handy document for beginers. I have worked on Oracle SOA for last few months and have come across many performance related issues while designing any SOA interface.
I was little bit curious if there could be any perfomance issue if we use File Adapter rather than using straight forward OS scripting.
Would you please share your views in this regard.

Many Thanks,

Debanj an
Quote
0 #4 Ajit101 2009-11-14 14:43
I could follow your very lucid article. I am new to Apps though. could you list out the steps to verify that the salary proposal has indeed been created from Apps UI?

TIA
Quote
0 #5 sangita deshmukh 2013-04-22 06:21
Very Nice Article to pull data from API
Quote

Add comment


Security code
Refresh

You are here: Home Contributors George Goosen BPEL- How to call an APPS API using BPEL and Flat file imports.