Oracle SOA 12.2.1 (SOA, OSB, OEP,ADF) Installation, RCU Creation, Domain Configuration

The installation has become quite easy from 12c versions of Oracle SOA.

1) Download SOA Suite 12.2.1 from Oracle website which comes with two zip folders. Unzip them to a same directory which will be having two jar files. Now execute below command in cmd console with administrative privileges.

soa

Provide the directory path and select appropriate options which completes the Installation.

2)  Now RCU Installtion. For this you must have Oracle DB (I suggest Oracle 11g XE edition).

Once you have DB on your machine go to folder ‘D:\Middleware12.2.1\Oracle_Home’ and execute rcu.cmd file. During the process give DB details which will then creates required schemas onto DB.

3) Now Domain Configuration. For this go to ‘D:\Middleware12.2.1\Oracle_Home\oracle_common\common\bin’ and execute config.cmd file.During configuration select required options and complete configuration.

You can found detailed steps of installation at below link.

https://dzone.com/articles/oracle-soa-1221-installation-and-configurations

 

 

 

\oracle_common\bin’

File Adapter in SOA

In this post I’d like to show you a sample application which continuously reads the data from CSV files (or text file with csv format) with a specified name pattern from a specified location and writes to a csv file in the specified location using File Adapters in Oracle SOA.

  • Let’s start creating a SOA applicaiton. Give the application name as ‘FileAdapterApp’ and give the project name as ‘FileAdapterProj’ and then select BPEL Process.
  • Give the name for BPEL as ‘FileAdapter_BPELProcess’ and select template as No Service

3

  • Drag and drop the File adapter like shown in picture

4

  • Give the name as ”Read_FileService’

5

  • Let the default selection be ‘Define from operation and schema (specified later)
  • Let the default File Server JNDI name as ‘eis/FileAdapter’
  • Selection Operation as ‘Read’ leave other fields as default
  • Give the directory path of the files from where SOA system will read the data from

6

  • Give the file name pattern, so that SOAsystem will only read the data from files whose file name matches with the specified pattern.

7.PNG

  • Let the parameters as default for File polling [Polling frequency 1 means for every one minute SOA system will check are there any new files to read in the specified directory]
  • In the Messages step click on gear icon to create a new schema for the file pattern which SOA system supposed to read.

8.PNG

  • Click Next in welcome format builder step, Let the file name as default ‘nxsd_schema1.xsd’ in File Name and directory step, Choose Type as ‘Delimited’.
  • Browse the sample file name so that SOA system understands the data type of file which it reads and so that it can generate xsd file accordingly.

9.PNG

  • Let the default options be checked in Record Organization step.
  • In the ‘Specify elements’ step give name for the element that will represent record as ’emp’

10.PNG

  • Let the default options be checked in Specify Delimiters and click on Next.
  • In the Fields properties Check ‘Use the first record as the fields names’
  • Click Next in Messages step and click on Finish.
  • Drag and drop the File adapter again and give the name as ‘write_FileReference’ and click on Next.

11.PNG

  • Let the default selection be ‘Define from operation and schema (specified later)
  • Let the default File Server JNDI name as ‘eis/FileAdapter’
  • Selection Operation as ‘Write’ and leave other fileds as default
  • Give the directory path of the files from where SOA system will Write the data to
  • Give the file Naming convention as ‘write%SEQ%.txt’, so that soa system will write the data to files and name it with the specified pattern.

12.PNG

  • In the Messages step click on gear icon to create a new schema for the file pattern which SOA system supposed to read.
  • Click Next in welcome format builder step, Let the file name as default ‘nxsd_schema2.xsd’ in File Name and directory step, Choose Type as ‘Delimited’.
  • Browse the sample file name so that SOA system understands the data type of file which it has to write like and so that it can generate xsd file accordingly.
  • Let the default options be checked in Record Organization step.
  • In the ‘Specify elements’ step give name for the element that will represent record as ’empl’
  • Let the default options be checked in Specify Delimiters and click on Next.
  • In the Fields properties Check ‘Use the first record as the fields names’
  • Click Next in Messages step and click on Finish.
  • Connect the File Adapters to the BPEL Service. While connecting File Read adapter if you get any popup leave the fields with default values and clock OK.

13.PNG

  • Now double click on BPEL in the composite, it’ll open the BPEL process.
  • Drag and drop the Recieve activity on to the Drop activity Here section of BPEL.

14.PNG

  • Now your BPEL looks like below.

15

  • Connect receive activity to Read_FileService, a pop up opens in which click on ‘+’ symbol to create a variable, let the name be as default and click OK. Then Apply and OK.
  • As we know to invoke any adapter service we should use Invoke activity, so drag and drop Invoke activity just below the Receive activity.

16

  • Connect the Invoke activity to the write_FileReference adapter, which opens a popup, click on ‘+’ symbol and let the name be default one and click OK and then Apply and again OK.
  • Now drag and drop the Assign activity just below the Receive activity and above Invoke activity.

17.PNG

  • Double click on Assign activity which opens a popup where map the variables of Receive activity to the variables of Invoke activity. Apply and OK.

18.PNG

Deployment:
Right click on project and then Deploy -> Project name -> Deploy to application server -> Check Overwrite any existing composites with the same revision ID -> select Integrted weblogic server -> Select ‘DefaultServer’ -> Next and Finish

Note: While deploying if you get any ‘There is no start activity error’ then double click on receive activity and select ‘Create Instance’ checkbox. Try to deploy again.

To test Composite is Active: Open ’em console’ go to SOA -> soa- infra(Default Server) ->   Deployed Composites Tab -> There you can see the deployed composite with name ‘FileAdapterProj[1.0]’ and check the status as Active.

Composite Testing:

Place a file with name read*.txt (eg: read1.txt) and with some sample data in it, in a read location which we mentioned while configuring File adapter for read operation.

For every minute SOA system will poll at this location and soon it finds the read file it reads the file and deletes it and then creates a new write file with name write%SEQ%.txt (eg: write1.txt) with the data which it fetches from the read file and places in the location which we mentioned during File adapter configuration for write operation.

19.png

Hope you like the post. Do Follow the blog for more updates 🙂

Translate Native Format File to XML File and Vice versa using Translator in SOA 12c

Translator is the new component introduced in SOA 12c which is very useful to convert any native format file like CSV to XML and vice versa.

Now am going to create a new application and BPEL process for doing this in JDeveloper 12.1.3

1) Create a new SOA Application named ‘TranslateApplication‘ and a project named ‘TranslateProj

Snap1

2) Select Composite with BPEL Process and click on Finish

3) Name the BPEL Process as ‘TranslateBPELProcess‘ and Template as ‘Synchronous BPEL Process’ and click on OK

Snap2

4) Drag and drop the Translate Activity which is under Oracle Extensions to the BPEL Process and double click on it.

Snap3

5) Click on the Search icon and for Input and assign the client:input variable to it

Snap4

6) For NXSD Schema field Click on the ‘New xsd icon’ and Select file type as Delimited and click on Next.

Snap5

7) In the next screen browse the File and click on Next.

Snap7

8) Select File contains only one record and Next. In next screen Enter the name for element as ‘Emp’

Snap8

9) Check the Use First Record as the Field Name and click on Next and Finish.

Snap9

10) Create an Output variable for assigning to reply Output and click on OK.

Snap10

11) Now open the created Schema and remove the few xsd:schema attributes which are not required (nxsd:hasHeader, nxsd:HeaderLines , nxsd:headerLinesTerminatedBy) and save it.

Snap11

12) Deploy the Project to server

Snap12

13)  Give the value for input as ‘Ravi, 15, 1000’ and click on Test Web Service and then click on ‘Launch Flow Trace’

Snap15

14) Click on Input and Translate to see the comma seperated input and XML output.

Snap16

15) If you are not able to see the Translate value in XML format then click on the deployed project and under settings change the Composite Audit Level to Development and test again. You can see the response in XML Format.

Snap18

BPEL Creation with DB Adapter usage and consuming it in ADF application as webservice

Story of Project:  We are going to pass the employee id from the ADF web application to SOA BPEL, which fetches more details of an employee from the database and returns them to ADF which are then shown on the ADF page. Tool used for this project is JDev 12.1.3

This Post includes the following

  • SOA Application creation
  • DB Adapter Configuration (for connecting to Database)
  • BPEL Creation (WSDL generation)
  • ADF Application Creation
  • Consuming the WSDL and create data controls
  • Test from the ADF Application

SOA Application Cretion:

Create a SOA Application with name ‘SOA_fetchDBdataApp’

Snap2

Create a Project ‘FetchEmpDataProj’ and select the Composite With BPEL Process while project creation

Snap3

Create a BPEL with the name ‘fetchEmpDetailsBPEL’ and select Template as Synchronous BPEL Process and then click OK

Snap4

The BPEL will be created with receiveInput and replyOutput as default schema components.

Snap17

Navigate to Databases tab and create a new Database Connection with the name with which we created in console

Snap21

Now Navigate the Database Adapter to the bpel flow

Note: Before proceeding from this step you should configure your DB Adapter in the console first. Please go through the DB Adapter configuration steps given at the end of the post.

Snap22

Give the dbreference name and click on Next

Snap23

Click on Search Icon and select the created Database Connection and click on Copy Connection

Snap24

Check only Select check box as we are doing only select operation in this example and click on Next

Snap25

Click on Query button to select the existing table in DB and move it to the selected area by clicking on right single row.

Snap26

Now remove the unneccessary  relationships by selecting each and clicking on remove button

Snap27

Click on Add button for creating a bind variable to the query which basically used to pass a variable dynamically. Generally to apply where condition its been used

Snap28

Click on Edit button beside to query click on Add button and then Check the Parameter option and select the created parameter ’empId’ from dropdown

Snap29

You can observer the modified SQL query

Snap30

Click on Next and finally Click on Finish

Snap31

Drag and drop the Invoke BPEL Constructor below to input and map to the dbreference

Snap34

Configure the Input and Output for this DB adapter. Click on + symbol and give names to the input and output variables.

Snap36

Now drag and drop the Assign Constructor below to input

Snap37

Double click on Assign which opens a Edit Assign popup in which map the input variable value to input of database adapter and click on Apply and OK

Snap38

Now assign the output of DB Adapter to the reply output of BPEL.  For that use Assign constructor.  Here the output of DB adapter has many fields so create as many outputs in the schema also to map from DB Output to BPEL output.

Open the schema file (.xsd file) and add the the required inputs and outputs in its source view

Snap35

Now drag and drop the Assign Constructor to below to DB adapter to  map the output of DB Adapter to BPEL output.

Snap40

And then double click on it for mapping. a popup window opens where map the output of DB adapter to output variable of BPEL. Map all fields directly. There is field named ‘EmpName’ at the output section for which the input should be from two fields (firstname, lastname) so drag and drop the Expression icon to the output field ‘EmpName’

Snap41

On Drag of Expression onto field a popup opens where click on concat and then click on first name and last name. The format should be concat(val1, val2) which combines the output of these two fields  and stores in EmpName field.

Snap42

Finally click on Apply and OK

Snap43

Deployment:

Save the project and right click on project-> Deploy

Snap44

Click on Deploy to Application Server.

Check the box Overwrite any existing composites with the same revision ID. which basically useful for generating same wsdl url for every deployment. Click on Next

Snap46

Click on Integrated weblogic server. Here you can add any server and deploy to that.

Select the domain (Default Server) and click on Finish which finishes the deployment.

Snap47

Open Enterprise Manager on browser. Select the project and click on Test

Snap51

Copy the WSDL to clipboard. Give the input as 102 and click on Test Web Service

Snap52

It opens the Response tab with the result. you can Launch Flow Trace to view the complete step by step response

Snap63

ADF Application Creation:

Create ADF Fusion Web Application ‘ADF_SOA_App’ keep the default names for the project.

Snap64

Create a custom project ‘consumeEmpWS’

Snap65

Right click on the created project -> New -> Select Web Service Client and Proxy

Snap66

Paste the copied WSDL URL in the WSDL Document URL field and click on Next and proceed by keeping default settings and Finish.

Right click on the WSDL and click on Test Web Service which opens a Http Analyzer.

Snap69

Give the input and click on Send Request which returns Response at right side.

Snap70

Now right click on the WSDL file and click on Generate Data Controls which generates the data controls which can be used on in the ADF page.

Snap72

You can see the updated data Controls Section

Snap73

Now Create a jspx page under View Controller Project.

Snap74

Check the JSP XML and name it ‘getDetails.jspx’

Snap79

Go to Source code of the page and then drag and drop the web service data controls on to the center facet of the page and select the option as ADF Parameter Form.

Snap76

Now right click on the page and click on Run

Snap77

In the page pass the Employee Id and you can see the more details which are fetched through BPEL and displayed on the page.

Snap78

DB Adapter Configuration:

This includes creation of Data Source, DB Adapter Outbound Connection Creation, mapping created Outbound Connection Creation with created data source.

Open Console and Create Data Source for connecting to the database.

Snap11

Create a New Generic Data Source

Snap13

Give the connection name as ‘HRConn’ and JNDI name as ‘jdbc/HRConnDS’ for the data source

Snap14

Give the Database Connection details and click on Next

Snap15

Click on Test Configuration which shows a success message for the successful connection. Click on Finish.

Snap16

Click on DbAdapter from the deployments

Snap5

Click on Configuration -> Outbound Connection pools -> New and then create an outbound connection

Snap7

Click on Next

Snap8

Give the JNDI name for the Outbound connection as eis/DB/HRConn

Snap20

Click on the Created Outbound Connection Pool

Snap9

Give the property  value for XA Data Source name as with earlier created DataSource jndi name ‘jdbc/HRConnDS’ and click on save

Snap61

Now again go to deployments and select DbAdapter and click on update which ends the DB Adapter Configuration.

Snap62