JCA Adapter:
The Database Adapter fills one gap of the Oracle Service Bus: there is no OSB transport for accessing a database and accessing the database was previously only possible from an XPath function in read-only mode. JCA transport used for this.To work with JCA Transport in OSB we need to do:
1.setup osb to work with JCA adapter
2.Create a simple SOA application with DB adapter to get .jca file.
3.Import jca file and its dependencies into Osb.
4.Create Business service and/or Proxy service using jca artifact.
5.Testing services.
1.setup osb to work with JCA adapter
- Login to weblogic console.
- Click on datasources in the home page to create new datasource.
- Click on New-->Generic datasource
- enter Datasource name and JNDI name as "jdbc/DB/MyDatabase_new" and click next.
- Select driver as "Oracle's driver (thin) for service connections;versions 9.0.1 and later" and click next.
- Enter your db details and click next and test connection in next page.(here pwd:Oracle123)
- In the select targets page select admin server( and osb_server also if you have installed managed server also while create osb domain) and save it.
- Click on Deployments in WLS home page.
- Enter JNDI name as " eis/DB/MyDatabase_new".(different from our datasourse JNDI name and click finish.
- Again click on the Connectionfactory name which we have just created to add datasource to this connectionfactory.
- Enter the datasourcename in this text box of XADatasourcename(jdbc/DB/MyDatabase_new) by double click in that property value field..enter the datasource name which we have created previously and click enter on keyboard and click save.
Note: Make sure that this connection factory has value for any one of XADatasource/datasoursename in this page.otherwise it will raise error.
And also make sure the datasourcename which we have created earlier and this XADatasource value Should be same.
- Go to deployments again and select the dBAdapter check box and click on update to take this changes effect.
- Click Finish.
- Restart the admin server.
2.Create a simple SOA application with DB adapter to get .jca file:
- Enter Project name and click next .select empty composite while prompt.
- click finish.It will open composite.xml file.In that drag and drop dbadapter from componet pallate to External references as shown.
- In the configuration wizard enter any name for service name and click next.
- create a new connection to pull tables or copy any existing connection and click next.
- Enter the JNDI name value which we have created in the outbound connection pools connectionfactory of WLS console..here “eis/DB/MyDatabase_new”.
- select the Operations you would like to perform on the table using this db adapter and click next to import table.
- Click on import table and select the required table and hit import.Click next .In define selection criteria we can add parameters to our select query if you want as follows.
- Click finish.It will generate all the files like .jca,.mappings files for this project. We need to import these files into osb console to create business services and using jca transport.
- Go to that project work space and select the required file and zip them.
- we need the following 5 files to export into osb console.
C:\JDeveloper\mywork\JCA_New_application\JCA_New_Project
and
- Zip all this 5 files.
3.Import these files into OSB console
- Login to service bus console http://localhost:7001/sbconsole
- Create a new session using change center.
- Create a new Project named as JCA_Project using Project explorer
- Click on the project and in create resource LOV select Zipped resources to import this files in to osb console.
- Click on choose file and navigate to select our zip file containing the above 5 files and click next.
- It shows our files and click on import.
- Click on the WSDL file in the Project.
- It will open our wsdl file .In that page Click on the Edit references as shown.
- Navigate to Project Explorer and click on your project-->near your jca file-->Click on the Export symbol,it will create Business service and its WSDL using this JCA file with jca transport.
- It Will open a window ,In that You can Modify Business service name and WSDL name and Click on Generate.I t will create the jca transported Business service.WE can open the business service to see this transport type as jca.
- Activate the session.Now we are done with JCA Transport Business service.We can test it using test console to work with database operations.Also we can create proxy service using this Business service.
5.Testing our Business service
Test 1:
- Click on the bug icon near our business service to launch test console.
- observe the result.As this is insert operation It wont give response here.Go to Your table data and observe that the new row we have given is being inserted.
- Now Launch the test console and select "serviceSelect"operation and click on execute.We have given Id as a parameter while configure our dbadapter in Jdev.So pass the any id and click on execute.
- observe the result in response document.It will bring the values from db.Hence done with testing.
Done.....