Tuesday, April 22, 2008

Creating OLite Connection from JDeveloper

Follow the steps below to configure connection to OLite DB from JDeveloper for ESB and BPEL tables.

1. Go to Connection Navigator

2 Right click Databases and select “Create New Database Connection”

Approach #1
3. Select “Third Party JDBC Driver” and click Next

4. Provide “system/any” as Username/password for SID:"oraesb" .

5. Provide “system/password” as Username/password for SID:"orabpel" .

6. You may need to create a Oracle Lite Jar classpath entry. Click Browse-> Add Entry 

and navigate to %ORA_HOME%\bpel\lib\olite40.jar

6. Provide the url for the connection as specified in %ORAHOME%\j2ee\home\config\datasources.xml

7. Test Connection and you are on your way.


Approach #2
3. Select “Oracle Lite” as driver and click Next
4. Provide “system/any” or "system/password" as Username/password.
5. Provide following details –
Host-localhost
Port-1531
SID – oraesb or orabpel for your SID of choice.
6. Test Connection and you should be on your way.

Tuesday, January 29, 2008

Correlation Illustrated

Correlation

This post would effort to explore the meaning and need of correlating requests and the best way to do them using Oracle SOA Suite.

What & Why
In common business scenarios it is not possible to have a synchronous response to each of our requests. Mostly the business has to deal with vendors, who would need to undergo a detailed process to come up with a solution. However, this response may not be necessarily binding business from carrying on its other activities. In such scenarios, the business enters in to asynchronous communication with these third parties. The async process necessarily stresses that the response may come back at a later time, through callback or polling mechanism as is suitable.

In case of a single instance its quite easy to match the response to request, however, when there are multiple instances the business would be wondering which request has been responded to. For example, if a travel booking agent spawns 10 requests for Frankfurt to Paris, and after a while airline responds to one of those 10 requests, it would not be safe to assume that this is a response to first request only. Hence the travel agent would tag in an ID to segregate one request for another, and would expect the airline to return this id unaltered to match the request. This id, which enables requestor to correlate the response sent by the provider, is called Correlation Id.

How (in Oracle BPEL)
Oracle BPEL provides us with two mechanisms through which an asynchronous callback message could map to its calling instance in the crowd.

  • WS-Addressing
  • Correlation Sets

WS-Addressing
“How does the callback maps to the correct instance out of so many waiting processes”, it’s a very common surprise to all beginners, creating first ever Asynchronous Invoke in BPEL Process Manager. The answer is, any time an asynchronous service is invoked, Oracle BPM, instills a message UID in WS-Addressing headers that float with SOAP Packets, which are used internally by the BPEL Server to correlate the flowing request/response.

This is the default mechanism supported by Oracle BPEL Process Manager, which is overridden automatically when the user opts to create his own correlation set.

Correlation Sets
Correlation Sets enable you to correlate asynchronous messages based on message body contents.

Why?

The question now arises, why ever would a BPEL developer like to over-ride default WS-Addressing correlation and use content-based correlation. Well, he won’t have to; if the called service is an Oracle BPEL, or the one, which supports and retains WS-Addressing headers sent, and returns the same in response.

The reasons, to use content-based correlation, could be many; some of the familiar ones that come to my mind are –

1. The asynchronous web service invoked by BPEL does not support/understand WS-Addressing headers.
2. When BPEL instance is expecting messages from a third party, for example, a file-poller.
3. When asynchronous call has multiple hops and reply is received directly from end system. For example, Request path is A > B > C > D and response comes to A directly from D, i.e. D > A.

How?

WE now understand and appreciate, need of correlation and the two mechanisms to achieve correlation. In WS-Addressing, we, as in developer, does not bother of how the correlation ID is created and maintained. However, in content-based correlation the responsibility of managing correlation set, defining property alias and initializing the correlation with appropriate value falls on developer.

To understand how to perform these tasks, we would start by understanding in which activities do we need correlation. The Correlation is required whenever data is going out or coming in to the BPEL process, hence Correlation works only with Invoke, Receive, Pick and Reply activities.

To create a correlation of our own, we need to create the Correlation Set first. A correlation set is a set of properties shared by all messages in the correlated group.

The correlation set is normally instantiated on invoke or receive activity. When correlation is instantiated on receive activity it is fairly straight forward, you create a correlation set, and select initiate = “yes”.

However, when you have to create correlation set on invoke, we have one addition option to understand, it’s the “pattern”. Now before we move ahead with “pattern”, lets explore what is “initiate” option.





If initiate option is set to “yes” this means that we assign the value to correlation variable. When initiate option is set to “no” this means, we want to validate the value against, value stored in correlation variable.

With this in mind, we would try to understand, the “pattern” option of Correlation tab in invoke activity.

When initiate = “yes”,
Pattern=”in” means the correlation is being instantiated with a value that is coming into the BPEL, from another service. Clearly, this invoke is then not the one which is invoking an asynchronous process, as the pattern suggests a response coming back.
Pattern = “out” means the correlation is being instantiated on the message that is going out of our BPEL.
Pattern = “out-in” means the correlation would be set on a variable that is part of both outgoing and incoming parameter, in this synchronous invoke. However, its nature is very much questionable.

When initiate=”no”
The above patterns would reflect which way the variable needs to be validated, inward, outward or both ways.

Creating a Correlation Set 

Correlation sets uses correlation tokens available inside messages, headers or business documents. Correlation tokens are the declarative properties of messages. A property is an element within a message identified by a query. Property aliases are the constructs to specify the queries to identify properties.

To create Correlation Set click the Create icon, and insert the appropriate values. As shown in the diagram below:



Here you would also need to create a Property (not shown in diagram above, its just beneath Xpath text box. This way we declared one of the property alias for instantiation, we need to create another one for validation.

Select the BPEL in diagram, in the adjacent Structure window, you would see set of properties. Right Click Property Alias, and select “Create Property Alias…”.



Now, select the appropriate message part, and then enter Xpath query string in the text box. You can use Ctrl+Space for Autofill.




Now, select the appropriate message part, and then enter Xpath query string in the text box. You can use Ctrl+Space for Autofill.

References :
Antony Reynold's Correlation
Antony Reynold's on Pattern and Initiate

Wednesday, January 23, 2008

Invoking Java - The WSDL way

WSIF defines additional binding extensions so that EJBs, local java classes, software accessible over message queues using the JMS API and software that can be invoked using the Java Connector architecture can also be described in WSDL.  

The Java binding is a WSDL binding that allows abstract functionality in the abstract service description (messages, operations and port types) to be mapped to functionality offered by a Java class directly. This means that a Java class can be described using WSDL, and can be accessed as a WSDL-described service through WSIF.

How to create a WSIF WSDL?

Add these two schema to your definitions tag
xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
xmlns:java=”http://schemas.xmlsoap.org/wsdl/java/”


The format namespace adds support for mapping Java types to XML schema.
The java namespace allows mapping WSDL operation to Java methods.

Specify binding Information



Binding name specifies the name which would be reffered from service tag.
Binding type specifies the portType, specified in WSDL
The java:binding tag identifies that this is bound to Java code rather than a SOAP service.

This binding would encompass, formatting information, i.e. which XML tag is to be mapped to what Java DataType



The format:typeMapping tag tells us that we will be mapping XML Schema types onto Java types.


The format:typeMap tag explains what Java type is to be used for each XML schema type in the interface.

The Service Tag refers to binding tag for mapping information.
The Java:address tag specifies fully qualified classname which contains implementations of operations specified inside binding tag.






Monday, January 21, 2008

Experiencing the Unimplemented

Implementing Link Activity on Oracle BPEL Process Editor

Business Process inherently supports sequencing of business tasks. The business processes, in real time, however, are always desired to run in parallel. Business process specification provides a structured activity called ‘Flow’ to achieve parallelism.

Illustratively, business process like Loan Approval would be looking in to run the Paper work, Field Investigation and Background Checking processes in parallel, so that the total turn-around time could be lessened. However, in this when scrutinized,


The bank won’t like to initiateApprovalProcess until FieldIntvestigation and BackgroundChecking process is complete. So here we have a scenario of holding activity in one sequence till other activities in parallel flow have completed.

This means I would like to somehow suggest the BPEL Process Manager, not to initateApprovalProcess Activity, till the other two sequences have been completed. Oracle BPEL does not provide any direct BPEL process activity to meet this end. However BPEL specification does not fail to mention an activity to cater this need. This activity is called the LINK activity.

In this scenario, we would declare a link name in scope of flow, as –

<links>
    <link name="BackgroundCheckLink">
    <link name="FieldInvestigationLink">
</links>


Now this link name is mentioned as source on the activity, which must complete, and as target for the activity, which needs to wait. In the above scenario, we would name two link activities, BackgroundCheckLink and FieldInvestigaitonLink.
BackgroundCheckLink is mentioned as source on BackgroundCheckSequence and FieldInvestigaitonLink is mentioned as source on FieldInvestigationSequence. Since both these links must have executed, both the links are mentioned as target on Invoke Activity.

<sequence name="BackgroundCheck">
    <source linkname="BackgroundCheckLink">
    :
    :
</sequence>
<sequence name="FieldInvestigation">
    <source linkname="FieldInvestigationLink">
    :
    :
</sequence>
<invoke name="InitiateApprovalProcess">
    <target linkname="FieldInvestigationLink">
    <target linkname="BackgroundCheckLink">
    :
    :
</sequence>


So, after this addition to your .bpel file, the activity would wait before activating initiateApprovalProcess invoke until, both the sequences, BackgroundCheck and FieldInvestigation have completed.

I need to present a case on how to provide conditioning on THE LINKS. May be some time soon.

Oracle Workflow Patterns

Simple Workflow
Some user activity is required for the business process to carry on. The business process may still continue, if human task expires, along some other flow.

Simple Workflow with Auto Escalation

When a human task expires, the task can then be escalated to assignee’s manager (default rule) or to some other person, as specified by the Escalation Function.

Simple Workflow with Auto Renewal

Renewal differs from Escalation, in terms, when the task is escalated; it goes to some other person, when renewed, the task is reassigned to the same user.

Sequential Workflow

This pattern, routes the human task to business users in a sequential manner.
Sequential Workflow with Escalation

In case some user is not performing an action for desired time, his task could be escalated to his supervisors.

Parallel Workflow
When multiple users work on a single task at a given point of time, for example, voting, this is termed as parallel workflow.

Parallel Workflow with Final Reviewer

Used to exist in earlier Workflow product of Oracle

Adhoc Workflow
The task is assigned to a user, where he decides where the task should go next, and completes when one of the assignees finally work on the task.

FYI Tasks
FYI tasks are those, which just allow the assignees to add comments/attachments, but their action does not affect the execution of business process.

External Routing Service
When a third party routing algorithm determines the assignment and routing policy,.

Task Continuation
Oracle allows you to perform a task continuation, where in the history, attachments and comments are accessible from the previous task. An example could be if you wish to implement Parallel workflow with final reviewer. The first task would be a group vote, and in second task, you can check task continuation, for the reviewer to understand basis of vote, if need be.

Problem with compensate in Oracle 10.1.3.1.0

There seems to be a problem with compensation handler implementation with Oracle 10.1.3.1.0. In case, you face similar problem, think upgrading to 10.1.3.1.3, instead of  investing time to pull out a solution.

The problem is :: A scope which throws the exception also gets compensated, even when it is not completed, which is  not in accordance with BPEL specification, which says, the scope should only be compensated if the scope is completed, faulting scope shall not be compensated.

Moreover, if a scope is not activated yet, i.e., no activity of this scope is executed, then this scope would not be compensated, even if some peer scope faults.

The controversial parallelism in Flow activity

There had been a lot of discussions detailing whether Flow activity provides parallelism as it promises. It was believed earlier, that Oracle does not provide parallelism under Windows OS, and they are working on it.


The common perception was all activities in lined sequences, were invoked one after the other, and the next activity is not picked up for execution lest the one in hand yeilds. However, observing a bit of experiments, this could be safely concluded that only synchronous Invoke activities bind the BPEL engine from executing any other activity. The wait, receive, pick and other such blocking activities are simply spawned and next activity is picked up for execution.