Introduction : Based on the following
application we can able to learn how to deal with FlatFile Inbound-
OutBound , JDBC Outbound Adapters.
Example Scenario :My sample application
needs get the data from flat file having customer id based on that
customer id get the data from data base and then print the data in
consol.
Solution:
- create a module : CustomerSampleModule
- Create a BO : CustomerIDBO
- create another BO : CustomerData
- create inbound FaltFileAdapter1. Select adapter : FlatFile select advanced option if we need any specific configuration.
3. Click on next. It will create on
adapter Project in our workspace.
As per our require ment we need to get
file having cama(,) saparated file. So for that we need to configure
DataFormatOptions
-- >select use dataformat
configuration for all operation then click on select to define data
binding
→ use existing data format
transformation “FlatFileBaseDataBinding” click on next
→ select binding type as
DataHandler select CVSDataHandler
→ click on finish. Then click on
next to Create a data transformation configuration. Give some name
then click on finish.
→ get back to external service window
click on next
→ In operations click on “ADD”
select
→ select Input type BO (our input bo
CustomerIDBO
→ select DataFormat options : use
Dataformat configuration
→ select dataformat as
DataBindingConfiguration which we created before.
→ then click on finish → then click
on next then specify the name of the export IF_FlatFile Export then
click on finish.
- Create JDBC Outbound Adapter.1. Select outbound adapters → jdbc → drag on to assembly diagram → select the websphere adapter for JDBC → click on next2. Specify the connector project name then click on next3. Add the JDBC Driver jar file then click on next
- select out database provider and then specify the details then click on next
- Then in next window click on edit query
As per our requirement we nee to
retrive the data based on our request parameter.
This was like select statement with
where clause.
So in edit query window specify the
SCEMA name and check the box shown below.
That means we want to write 1 select
query → then click on ok
- Click on “Run Query”
- Then select on query statements click on > button to add into Selected Objects.
- Specify the details and click on validate button to validate the query which we entered.
Here we are specifying the
parameterized query in select statement.
Query : SELECT * FROM RAMYA.CUSTOMER
where custid = ?
then click on next
- Composite Properties :1. here we can able to add some faults which may occur in this select statement.(if need)2. We can able to specify the folder name to store these bo's3. Uncheck generate BG for each BO ( like we need not wrapper class for this requirement) then click on next.
- In deployment properties select other( we will specify authentication details in JNDI internally)* if u want to use connection pool uncheck join global transaction else use XA DataSource based on requirement. Here I am using XA resource
then click on next
- Specify InterfaceName : IF_JDBCImport then click on Finish.
create JDBC Datasource in Admin Consol
- Admin console → Resources → JDBC → DataSources → select scope then click on new to create2. Enter data source name and JNDI name( which is given in Adapter) then click on next3. Create new JDBC Provider ( if we don't create before for this database) click on next or use existing database provider from list.4. Specify the database properties for the data source then click on next5. Select authentication alias details or create if not exist. Click on this6. Click on new to create then specify all details then click on ok and save.
- selet this authentication alias click on next → it will show information then click on finish.
- Then save this configuration on server.
- Test connection.
Implement the BPEL to retrive the data
based on input customer id.
Note: to run this application check the
FlatFile and JDBC resource adapters should be installed in your admin
consol