In this simple scenario we will read in an order via the FileAdapter. This order will be processed and, if approved, saved to file (non-domestic orders) or written to the Orders DB(domestic orders).
Create 2 directories on your file system (in & out) e.g.
Create a new BPM Application/Project
Define the File Adapter (Read)
Create File Adapter (Read) in composite.xml
Point to the input directory you created.
Poll every 5 seconds for docs of type *.xml
Set type to InOrder as defined in myOrder.xsd at Appendix A.
Define the File Adapter (Write)
Create File Adapter (Write) in composite.xml
Point to the output directory you created.
Set type to OutOrder as defined in myOrder.xsd at Appendix A.
Define the Database Adapter
Use Orders table defined at Appendix B.
select all columns
Leverage the Adapter Services in BPM
Back in the BPM Project navigator –
Create a Project Data Object for the incoming order
Edit the Start activity to leverage the file adapter (read) service
Delete the UserTask. We will add it again later, now we just want to test the adapters.
Drop a Service onto the page.
Create a second service task
Add Exclusive Gateway
Set Condition for Domestic.
Deploy & Test
Ensure you have set up the required DB artifacts on WLS before testing.
- In WLS Console -
-- Define a Datasource e.g. jdbc/scott
-- Target to soa_server1
-- Define a new connection pool (Deployments --> DBAdapter --> New)
--- Configuration --> New -->Outbound connection Pools
---- enter name you used when defining the DB adapter in your project e.g. eis/DB/scott
---- Edit the new connection pool and set xaDataSourceName to jdbc/scott
Back to the Deployments list -
Select DB Adapter --> then press Update
Test using xml payloads at Appendix C.
Non-Domestic orders written to the \out directory
Appendix A XSD
Appendix B Database Table SQL
CREATE TABLE ORDERS
ORDER_NR VARCHAR2(20 BYTE) NOT NULL
, CUSTOMER VARCHAR2(50 BYTE) NOT NULL
, EMAILADDR VARCHAR2(50 BYTE) NOT NULL
, COUNTRY VARCHAR2(50 BYTE) NOT NULL
, PHONE VARCHAR2(50 BYTE) NOT NULL
, PRODUCT VARCHAR2(50 BYTE) NOT NULL
, QUANTITY NUMBER(10, 0) NOT NULL
, UNITPRICE NUMBER(10, 2)
, SUPPLIER VARCHAR2(50 BYTE)
, TOTALPRICE NUMBER(10, 2)
, ORDERSTATUS VARCHAR2(50 BYTE)
, COMMENTS VARCHAR2(256 BYTE)
, CONSTRAINT SYS_C005116 PRIMARY KEY
Appendix C - Test Payload