SOA : Tutorial - Search Employee

Lets create an employee search service using Oracle SOA.
We will create a service which will take an employee name as input return the employee details as output.
We will use the sample HR schema which is available in the Oracle XE database.


Prerequisites:
1) Unlock the sample HR schema present in the Oracle XE database.
2) Create Database and Application Server Connections in JDeveloper.
3) Create JDBC datasource in weblogic console.



1) Download SearchEmployee.xsd file and save it in a temporary location on your computer.

2) Create a SOA project with the name SearchEmployee



2) Drag and drop 'BPEL Process' on to the Composite.
    Enter a name for the BPEL process and change the Template to 'Synchronous BPEL Process'.
    Click on the browse icon of Input.
 
 -------------------------------------------------------------------------------------------------------

2.1) Click on Import Schema File.
        Browse and select the  SearchEmployee.xsd downloaded in step 1.
       
  -------------------------------------------------------------------------------------------------------

2.2)Select EmployeeSearchInput and click OK.
-------------------------------------------------------------------------------------------------------

2.3) Similarly click on the browse icon of Output and select EmployeeSearchResult.
-------------------------------------------------------------------------------------------------------

2.4) Click OK to Create BPEL Process.


3) We can see the newly created BPEL process in the Components(center) lane in the SOA Composite.
     Right click to edit the BPEL process.



4)  We can see the BPEL process in the editor.
      Drag and drop the Database Adapter between the receive and reply.


------------------------------------------------------------------------------------------------
4.1) Enter the Database Adapter Service Name as search_employee_db
------------------------------------------------------------------------------------------------
4.2)Select the XE db connection and change the JNDI name to eis/DB/hr

------------------------------------------------------------------------------------------------
4.3)For Operation Type select Perform an Operation on a Table and choose only the Select operation.

------------------------------------------------------------------------------------------------
4.4)Import the EMPLOYEES table.

------------------------------------------------------------------------------------------------
4.5)No changes needed in the Relationships and Attribute Filtering
------------------------------------------------------------------------------------------------
4.6)In Selection Criteria add a parameter pEmpName and append the following to the sql query :
       where first_name = #pEmpName and rownum <2


------------------------------------------------------------------------------------------------
4.7)Click next and finish the wizard.
      Click OK to create the DB Adapter.



5) Drag and drop an Invoke activity after receiveInput.
    Rename the Invoke to Invoke_search_employee_db.
    Drag and connect the invoke activity to the Database Adapter(search_employee_db).


------------------------------------------------------------------------------------------------
5.1) Click on the plus icon for Input and Output and create search_InputVariable and search_OutputVariable respectively.


6) Drag and drop an Assign activity after receiveInput.
    Rename the Assign to Assign_search_input.




7) Edit the Assign_search_input and connect EmployeeName under inputVariable on the left to pEmpName under search_InputVariable on the right.





8)  Drag and drop an Assign activity before replyOutput.
    Rename the Assign to get_search_output.





9) Edit the get_search_output and connect the attributes of  Employees under search_OutputVariable on the left to attributes of  EmployeeSearchResult under OutputVariable on the right.





10) Deploy the SOA composite :
      Right-Click the Project and select : Deploy --> SearchEmployee
      In Deployment Action select Deploy to Application Server and click Next.


11) Click Next in the Deploy Configuration



12) Select the application server connection to your SOA server and click next.


13)  Select your SOA server and click finish.


14) You can see if the deployment is successful from the deployment log.




15) To test the composite go to the enterprise manager(weblogic/welcome1) and click the SearchEmployees SOA composite in the home page.




16) Click Test in the composite details page.



17) In the Test Web Service page enter a value for the input field in the request tab and click Test Web Service.



18)  You will see the result in the Response tab.





Below is the video tutorial for creating the same Search Employee example in Oracle SOA.

ADF : Tutorial - Find weather using ADF and SOA

A webservice is exactly what its name says, it is just a service.
It will provide you with a service like for eg: taking a city name as an input and providing you with the corresponding weather details as an output.

You don't have to worry about the underlying implementation of the SOA webservice.
But you do have to worry about what to do with the output of the webservice.
You need to provide a UI for the end user to enter the input parameters and to display the output of the service invocation.

You can use various technologies/frameworks to build a UI on top of a SOA webservice.
ADF is one of them.
Lets see how to build an ADF UI on top of a publicly available webservice.

We will use the Global Weather public webservice.
WSDL : http://www.webservicex.net/globalweather.asmx?WSDL

SOA : Tutorial - Hello World


Lets create the equivalent of the famous Hello World program using Oracle SOA.
We will create a SOA composite which will take a name, prefix it with Hello and return the output.

Prerequisites:
1) You need to Create a SOA project with an empty composite.
2) You need to Create an Application server connection to your SOA server.

ADF : Create a SOA web service data control

Web services created in SOA can be consumed in a variety of applications.
You can build an ADF ui on top of a web service to display the data in a user friendly way.

The first step for using a SOA web service in an ADF application is to create a web service data control.
The UI can be any thing like ADF UI, ADF mobile UI, Excel spreadsheet etc.
The data control provides access to the underlying SOA web service without exposing any of the implementation details.
The UI layer need not know any of the technical details of the underlying SOA web service.

Lets see how to create a web service data control in ADF.
We will use a publicly available web service for this example.
Lets use the Global Weather web service.


SOA : Create a SOA project in Jdeveloper

One of the first things to do before you can try your hand at developing SOA artifacts is to create a SOA project.
Lets see how to create a SOA project in JDeveloper in a few simple steps.

1) In JDeveloper go to File --> New
2) Select General --> Applications and select SOA Application on the right and click OK.



Installing Oracle SOA suite 11g (11.1.1.7)

Installing Oracle SOA Suite is a fairly straightforward process.
We will see how to do this installation on a Windows 7 based machine.

These instructions are generic, you can use these instructions for both 32 and 64bit machines.
You will need at least 4GB of RAM on your laptop/desktop or you might run into the dreaded out of memory errors.

You will need to download the following files to proceed with the installation.
Go to Oracle SOA suite download page here.
Under Oracle SOA Suite 11g Installations, select release 11.1.1.7 and then Microsoft Windows 32-bit JVM.

Download the following files.
  • Database (OracleXE112_Win32.zip).
  • WebLogic server (wls1036_win32.exe)
  • Repository creation utility (ofm_rcu_win_11.1.1.7.0_32_disk1_1of1.zip).
  • Jdeveloper (jdevstudio11117install.exe).
  • SOA (ofm_soa_generic_11.1.1.7.0_disk1_1of2.zip and ofm_soa_generic_11.1.1.7.0_disk1_2of2.zip)
You need to download Jdeveloper SOA extension from a different location.
  • Jdeveloper SOA extension (Download from here).

SOA : Configuring E-Mail Driver


There are lot of ways to send notifications to the users in SOA.
E-Mail, SMS, IM, VoiceMail etc are some of the forms of notifications.

Lets see how to configure the email driver to send emails using a local mail server.
We will use the same send emails from within BPEL.
You need to configure a local mail server before you proceed. See here.

SOA : Deleting from MDS

You might want to delete unused artifacts from the central MDS.
You can do so by following the below steps:
Make sure the WebLogic server is runinng before proceeding ahead.



Step 1
Open command prompt and go to the following location:
<mw_home>\Oracle_SOA1\common\bin\
mw_home : Folder where all the SOA Components like WebLogic are installed.

SOA : WebLogic startup Out Of Memory Errors


While starting the WebLogic SOA Server you might see the following error sometimes.

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


There are two ways to resolve this error.
1) Reduce the MaxPermSize if you don’t have enough RAM(less than 4GB) or if you are running a 32-bit OS.
2) Use a 64-bit JDK if you have enough RAM(more than 4GB) and a 64-bit OS.

SOA : Deploying XSD to Central MDS

Storing common artifacts that are used across projects in the MDS repository is a good idea.
It ensures that the artifacts are centrally managed and any changes are easily propagated to all the consumers.
Lets see how to deploy XSD files to the MDS in SOA.
First you need to create a Central MDS connection. See here.
By doing this you can use the same XSD file from the central MDS in multiple projects.


Step 1
First, we need to create a new SOA project.
Right Click on the application and select New Project.

Image 001

SOA : Creating MDS Connection

In this post we will see how to create an MDS connection.

There are two types MDS repositories available.
1) Central MDS : This MDS is DB based, used during runtime and is available only when the SOA server is running.
2) Local MDS : This MDS is file based, used during design time and is available even when the SOA server is not running.

SOA : Creating DataSource in WebLogic console


In this post we'll see how to create a JDBC data source in the weblogic console.
First you need to unlock the HR schema in the oracle database.

Open the weblogic console at the following URL
http://localhost:7001/console
Username/password : weblogic/welcome1