Friday, February 15, 2013

WPS: Based on the following application we can able to learn how to deal with FlatFile Inbound- OutBound , JDBC Outbound Adapters.



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:
  1. create a module : CustomerSampleModule
  2. Create a BO : CustomerIDBO
  3. create another BO : CustomerData
  4. create inbound FaltFileAdapter
    1. Select adapter : FlatFile select advanced option if we need any specific configuration.

           2. Click on next → next the name the connector project with meaning full name

    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.



  1. Create JDBC Outbound Adapter.
    1. Select outbound adapters → jdbc → drag on to assembly diagram → select the websphere adapter for JDBC → click on next
    2. Specify the connector project name then click on next
    3. Add the JDBC Driver jar file then click on next
  2. select out database provider and then specify the details then click on next
  1. 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
  1. Click on “Run Query”

  1. Then select on query statements click on > button to add into Selected Objects.
  2. 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
  1. 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's
    3. Uncheck generate BG for each BO ( like we need not wrapper class for this requirement) then click on next.
  2. 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
  1. Specify InterfaceName : IF_JDBCImport then click on Finish.


create JDBC Datasource in Admin Consol

  1. Admin console → Resources → JDBC → DataSources → select scope then click on new to create

    2. Enter data source name and JNDI name( which is given in Adapter) then click on next
    3. 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 next
    5. Select authentication alias details or create if not exist. Click on this

    6. Click on new to create then specify all details then click on ok and save.

  1. selet this authentication alias click on next → it will show information then click on finish.
  2. Then save this configuration on server.
  3. 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