In my previous article I have discussedA�the configuration steps of database resource in SOA Administration Console. Now I am going A�to give example ofA�select operation on Database adapter.
Create a table XXSOA_EMP_TAB in database. Data will be selected based on the parameter dept id.
SQL Script:
CREATE TABLE XXSOA_EMP_TAB (empid NUMBER
,empname VARCHAR2(20)
,dob DATE
,salary NUMBER
,deptid NUMBER
);
INSERT INTO XXSOA_EMP_TAB (100, a�?sachina��, a��04-jun-1978a��, 12000, 10);
- Create a SOA project. Right click on application -> Project. Enter project name a�?DBAdapterPrja��
- Click on Next and select composite as a�?Composite With Mediatora��
- a�?Create Mediatora�� wizard will open. Enter Mediator name a�?DBAdapterTestMediatora�� and select template type as a�?Define Interface Latera��.
- Click on OK
- Drag a database adapter from components palate and drop it in the a�?External Referencesa�� swim lane.
- a�?Database adapter configurationa�� wizard will open. Enter a reference name.
- Click on green plus icon to create new database connection and Enter XE database connection details.
- Then select JNDI Name by clicking on search icon.
- Click on OK. Now Service Connection wizard will look like below screenshot.
- Select operation type as a�?Selecta��.
- Click on NEXT and select database table for operation
- Click on a�?Import Tablesa�� and select table.
- Click on OK
- Click on NEXT and select primary key in the table
- Click on NEXT
- Click on NEXT and select the attributes which will be displayed in output.
- Now create parameter for selecting data from table based on dept id.
- Click on ADD and enterparameter name
- Click on OK and expression builder window will open. Select second argument as a�?parametera�� and select parameter name from drop-down list.
- Click on OK and SQL statement will be changed automatically according to parameter.
- Click on NEXT and select default advanced options also.
- Click on NEXT and then FINISH. DB adapter configuration is finished.
- Select SOAP service and drag and drop it in a�?Exposed Servicea�� area. Create Web Service wizard will open. Enter service name and select type as a�?Servicea��.
- Click on a�?coga�� icon to create WSDL for the SOAP service. a�?Create WSDLa�� wizard will open.
- Select Interface type as a�?Synchronous Interfacea��
- Now create input and output message. Click on green plus sign to create input message part
- Create output message part and select XSD from project that is used by db adapter.
- Click on OK
- a�?Create WSDLa�� wizard will be looking like this.
- Click on OK
- Click on OK and SOAP service will be created.
- ConnectA�all the components.
- Double click on mediator and mapping file will open.
- Click on mapping icon in request part and create new mapper file for request. Click on green plus icon and Enter name of the mapper file.
- Now map the input request to the dept id (input of the DB adapter).
- Click on mapping icon in synchronous reply and create new mapper file for output
- Mapper file for response will look like the below screenshot.
- Map the output of the DB adapter (source) to the response output (target).
- Deploy the project. For deployment process refer my previous article HelloWorld Mediator.
- The project can be tested from jdeveloper also. Go to Application Servers tab and select the project.
- Right click on project (dona��t select default one) and select a�?Test Web servicea��
- Test window will open. Give input string in the in the request SOAP header part. Click on a�?Send Requesta�� and the response will appear.