Redeploy the BPEL project and retest.

14-2 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

14.2 Creating a Pick Activity to Select Between Continuing a Process or Waiting

The pick activity provides two branches, each one with a condition. The branch that has its condition satisfied first is executed. In the following example, one branch’s condition is to receive a loan offer, and the other branch’s condition is to wait a specified amount of time. Figure 14–1 provides an overview. The following activities take place in order of priority: 1. An invoke activity initiates a service, in this case, a request for a loan offer from Star Loan. 2. The pick activity begins next. It has the following conditions: ■ onMessage This condition has code for receiving a reply in the form of a loan offer from the Star Loan web service. The onMessage code matches the code for receiving a response from the Star Loan web service before a timeout was added. ■ onAlarm This condition has code for a timeout of one minute. This time is defined as PT1M, which means to wait one minute before timing out. In this timeout setting: – S stands for seconds – M for one minute – H for hour – D for day – Y for year In the unlikely event that you want a time limit of 1 year, 3 days, and 15 seconds, you enter it as PT1Y3D15S. The remainder of the code sets the loan variables selected and approved to false, sets the annual percentage rate APR at 0.0, and copies this information into the loanOffer variable. The time duration format is specified by the BPEL standard. For more detailed information on the time duration format, see the duration section of the most current XML Schema Part 2: Datatypes document at: http:www.w3.orgTRxmlschema-2duration 3. The pick activity condition that completes first is the one that the BPEL process service component executes. The other branch then is not executed. Using Events and Timeouts in BPEL Processes 14-3 Figure 14–1 Overview of the Pick Activity An onMessage branch is similar to a receive activity in that it receives operations. However, you can define a pick activity with multiple onMessage branches that can wait for similar partner links and port types, but have different operations. Therefore, separate threads and parallel processes can be invoked for each operation. This differs from the receive activity in which there is only one operation. Another difference is that you can create a new instance of a business process with a receive activity by selecting the Create Instance checkbox, but you cannot do this with a pick activity.

14.2.1 How To Create a Pick Activity

To create a pick activity: 1. In the SOA Composite Editor, double-click the BPEL process service component.

2. In the Component Palette, expand BPEL Constructs.

3. Drag a Pick activity into the designer.

The Pick activity includes an onMessage branch. Figure 14–2 provides an example. Note: You can also create onMessage branches in BPEL 1.1 scope activities and onAlarm branches in BPEL 1.1 and 2.0 scope activities. Expand the Scope activity in Oracle JDeveloper, and browse the icons on the left side to find the branch you want to add. Initiate service invoke Wait for callback onMessage Logic Post Callback Star Loan Logic Post Timeout Time out in 1M onAlarm pick BPEL Process WSDL