Monday, July 18, 2011

Leveraging SDOs in BPM11g

In this simple scenario we will process orders that adhere to the following XSD

btw. a great resource that I often refer to is Antony Reynolds/Matt Wright --> Oracle SOA Suite 11g Developers Guide. If you don't already have it - then get it!

Ok back to business...



The underlying DB tables are as follows (I've created them in SCOTT's schema)–



DDL is available at Appendx A

Scenario
We are used to having payloads that contain all of the order attributes. We can imagine an Order Entry UI where the Order & customer details are entered. We could pass all of this on to BPM via the payload. However a more efficient way may be to leverage SDOs and just pass the keys e.g. OrderId, CustID on to BPM. BPM can then load the data in just in time mode from the DB using the SDO.

Setup
You need to have your DB schema installed. I create 1 customer so that I’ve something to test.



Create an ADF App in JDeveloper
This app will contain ADF-BC artifacts that we will expose via a Service Interface.



Set App name in project properties to something more readable as the default.



Create a BC App Module based on the tables we created.







Open the AppModule and click on Service Interface, then the +







Do the same for the other views.

FYI: Here is an extract from the official docs, detailing the operations.






The following files are generated



Test

We can test the SDO using OrdersAMServiceImpl




Running this app will deploy it to the integrated WLS and open the test page in your browser.
Select the getAmCustomerView1 operation
- Enter 1 as the cust id






Deploy to SOA Admin Server
Change the wsdl url to point to the target port
- Per default it is generated for 7101 (the JDev integrated WLS).



Add the following to the weblogic-application.xml






This enables us to register the SDO as an RMI Service.

The Datasource used by ADF-BC (jdbc/scottDS) needs to be XA aware.
The default generated/deployed by ADF-BC is not what we require, so we have to do 2 things - de-activate auto-generation of the weblogic-jdbc.xml and create the necessary datasource on our target WLS.




Using the WLS console, create a datasource jdbc/scottDS.
Per default it will be XA aware.

Create a new deployment profile of type Business Components Service Interface




Give the application a more meaningful name



Deploy from the Application Menu




Test



Leverage SDO in a BPM Composite

Create a BPM app



In Composite.xml --> add an ADF-BC Service (Reference).



Note: Registry name set to ADF app name + _JBOServiceRegistry.



Now we add a FileAdapter(ReadOrders) which will pass in the custID.
In the BPM designer, set Start implementation to ReadOrders.



Add a Service activity to retrieve the customer from the DB.





Deploy & test






Appendix A

ALTER TABLE AM_PRODUCT
DROP CONSTRAINT AM_PRODUCT_AM_ORDER_LINE_FK;

ALTER TABLE AM_ORDER_LINE
DROP CONSTRAINT AM_ORDER_LINE_AM_ORDER_FK;

ALTER TABLE AM_ORDER
DROP CONSTRAINT AM_ORDER_AM_CUSTOMER_FK;

DROP TABLE AM_PRODUCT CASCADE CONSTRAINTS;

DROP TABLE AM_ORDER_LINE CASCADE CONSTRAINTS;

DROP TABLE AM_ORDER CASCADE CONSTRAINTS;

DROP TABLE AM_CUSTOMER CASCADE CONSTRAINTS;

CREATE TABLE AM_PRODUCT
(
PRODUCT_ID VARCHAR2(20) NOT NULL
, PRODUCT_NAME VARCHAR2(20) NOT NULL
, PRODUCT_PRICE DECIMAL NOT NULL
, PRODUCT_DESCRIPTION VARCHAR2(255)
, ORDER_LINE_ID VARCHAR2(20)
, CONSTRAINT AM_PRODUCT_PK PRIMARY KEY
(
PRODUCT_ID
)
ENABLE
);

CREATE TABLE AM_ORDER_LINE
(
ORDER_LINE_ID VARCHAR2(20) NOT NULL
, ORDER_LINE_ITEM_DISCOUNT DECIMAL NOT NULL
, ORDER_LINE_ITEM_QUANTITY NUMBER NOT NULL
, ORDER_ID VARCHAR2(20)
, CONSTRAINT AM_ORDER_LINE_PK PRIMARY KEY
(
ORDER_LINE_ID
)
ENABLE
);

CREATE TABLE AM_ORDER
(
ORDER_ID VARCHAR2(20) NOT NULL
, ORDER_STATUS VARCHAR2(20) NOT NULL
, ORDER_DISCOUNT DECIMAL
, ORDER_COMMENTS VARCHAR2(255)
, CUST_ID VARCHAR2(20)
, CONSTRAINT AM_ORDER_PK PRIMARY KEY
(
ORDER_ID
)
ENABLE
);

CREATE TABLE AM_CUSTOMER
(
CUST_ID VARCHAR2(20) NOT NULL
, CUST_NAME VARCHAR2(20) NOT NULL
, CUST_EMAIL VARCHAR2(20) NOT NULL
, CUST_CREDITCARD_TYPE VARCHAR2(20) NOT NULL
, CUST_CREDITCARD_NR VARCHAR2(20) NOT NULL
, CONSTRAINT AM_CUSTOMER_PK PRIMARY KEY
(
CUST_ID
)
ENABLE
);

ALTER TABLE AM_PRODUCT
ADD CONSTRAINT AM_PRODUCT_AM_ORDER_LINE_FK FOREIGN KEY
(
ORDER_LINE_ID
)
REFERENCES AM_ORDER_LINE
(
ORDER_LINE_ID
)
ENABLE;

ALTER TABLE AM_ORDER_LINE
ADD CONSTRAINT AM_ORDER_LINE_AM_ORDER_FK FOREIGN KEY
(
ORDER_ID
)
REFERENCES AM_ORDER
(
ORDER_ID
)
ENABLE;

ALTER TABLE AM_ORDER
ADD CONSTRAINT AM_ORDER_AM_CUSTOMER_FK FOREIGN KEY
(
CUST_ID
)
REFERENCES AM_CUSTOMER
(
CUST_ID
)
ENABLE;

Wednesday, July 6, 2011

SOA Suite 11g: Test 2 Production via Config Plan

Scenario:
I have a simple SOA composite that calls a validation service.
I develop this in my test environment using the validation web service running on the test server. Now I'm deploying to production and need to leverage the web service running on the production server.

Create a new Application in JDev that will contain 2 web service projects -





Expose as web services



Deploy the web services to WLS.

Check the 2 URLS:

http://localhost:7001/Test-ValidatePerson/ValidationServicePort?WSDL
http://localhost:7001/Prod-ValidatePerson/ValidationServicePort?WSDL

Create a SOA composite with a sync BPEL process.
Invoke the test service from BPEL





Deploy & Test



back in JDev, right click on composite.xml and select Generate Config Plan



Here I can replace the Test with the Prod WSDL





Re-deploy, selecting the config plan



Re-test

Tuesday, July 5, 2011

SOA Suite 11g - FTP Adapter

Here is a simple lab demonstrating use of the FTP adapter.

I'm using FileZilla as my FTP Server.

I created the following directories




FTP Server Configuration

I create a user NiallC/NiallC
and configure the shared folders as follows -




Create FTP Adapter artifacts using WLS Console

Deployments --> FtpAdapter --> Configuration --> Outbound Connection Pools --> New



Edit the properties as follows -

host=localhost
password=NiallC
port=21
username=NiallC
serverType=win











Create a new SOA app



In this example I read in an(GET) order and then write it out (PUT).




Configure the read adapter as follows -







Configure the write adapter as follows -





Add the Mediator and specify the transformation.

That's it.


App at
https://docs.google.com/leaf?id=0B7YrnfO7h717ODc1ZTY2MTgtMTMzNS00ZTM4LWFkM2UtYjcyNjExMWMzOWIy&hl=en_US