Thursday, January 2, 2014

#299 BPM APIs revisited - DirectBinding and Facade APIs

Direct Binding Invocation -

A common way to invoke a composite is to use SOAP over HTTP.
This is enabled by creating a SOAP service for your composite using web service binding. 
You can also use direct binding, which provides a tighter integration alternative. 

Direct binding enables Java clients to directly invoke composite services, 
bypassing the intermediate conversion to XML required with web service binding. 

Direct Binding Invocation API -

Here we leverage oracle.soa.management.facade.Locator

The following composite contains a BPM process that can be invoked via direct binding.




















The client code is relatively simple.
I tested the composite in EM to see what the payload should look like.












I then created the Java client -




















The direct binding connection supports

- post
- request

post can be used for invoking asynchronous processes such as the following -









We then need to define a conversation Id -







Here is the output from a test run -













Validate in EM -













Here is an example for request - 












Example test output -













Validate in EM -
























Facade API

Here is the demo composite I am using here



















The Facade API exposes operations and attributes such as composites, components, services, and references for programmatically managing SOA composite applications during runtime. The Facade API is part of Oracle SOA Suite's Infrastructure Management Java API.

The API can be used to query the composite and get info such as -



Composite DN = default/FacadeAPIDemoComposite!1.0

Composite State = on

Composite Instance count = 0

*** Component DN = default/FacadeAPIDemoComposite!1.0/ApproveOrder

*** Component Name = ApproveOrder

*** Component Type = workflow
*** Component Total Instances = 0
*** Component Active Instances = 0
*** Component DN = default/FacadeAPIDemoComposite!1.0/DemoProcess
*** Component Name = DemoProcess
*** Component Type = bpmn
*** Component Total Instances = 0
*** Component Active Instances = 0

I now create a couple of composite instances and run the API client again -

init() start ...
init() complete
getInstances() for composite default/FacadeAPIDemoComposite!1.0
*** Found 2 Composite Instances.
Composite Instance DN = default/FacadeAPIDemoComposite!1.0
Composite Instance State = 0
Looking for Composite Components...
Component Name = DemoProcess
*** Type bpmn
*** Component State = 1
*** Component Status = initiated
*** Component normalized State = running
Component Name = ApproveOrder
*** Type workflow
*** Component State = 1
*** Component Status = ASSIGNED
*** Component normalized State = running
Composite Instance DN = default/FacadeAPIDemoComposite!1.0
Composite Instance State = 0
Looking for Composite Components...
Component Name = DemoProcess
*** Type bpmn
*** Component State = 1
*** Component Status = initiated
*** Component normalized State = running
Component Name = ApproveOrder
*** Type workflow
*** Component State = 1
*** Component Status = ASSIGNED
*** Component normalized State = running
Process exited with exit code 0.

The Facade API Client Code can be found here

I now add a composite sensor for the OrderNr on DemoProcess.service







I can now leverage the api to get this information as well as the ECID etc.
I can also select composite instances based on the ECID, see the method - getInstances4ECID()

The API can also be used to delete composite instances. For example - stale instances -













I ran getInstances4ECID() again and see that the state = 6












Now I can delete stale instances using the method - deleteCompositeInstances4State()






















Again, Java Code etc - here

Related Blog Posts



Suggested Reading -

Workflow Services API -
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e10660/toc.htm

Facade API

http://docs.oracle.com/cd/E28280_01/admin.1111/e10226/soaadmin_apimanage.htm

http://docs.oracle.com/cd/E17904_01/apirefs.1111/e10659/oracle/soa/management/facade/CompositeInstance.html

BPM APIs
http://docs.oracle.com/cd/E28389_01/apirefs.1111/e25378/overview-summary.html

FMW Dev Guide for SOA Suite
http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/toc.htm

No comments: