What Happens When You Invoke a Synchronous Web Service

7-6 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite portType=ns2:CreditAuthorizationPort operation=AuthorizeCredit

7.3 Specifying Timeout Values

You can specify timeout values with the property SyncMaxWaitTime in the System MBean Browser of Oracle Enterprise Manager Fusion Middleware Control. This property defines the maximum time a request and response operation takes before timing out. If the BPEL process service component does not receive a reply within the specified time, then the activity fails.

7.3.1 How To Specify Timeout Values

To specify timeout values: 1. Log in to Oracle Enterprise Manager Fusion Middleware Control.

2. From the SOA Infrastructure menu, select SOA Administration BPEL

Properties .

3. At the bottom of the BPEL Service Engine Properties page, click More BPEL

Configuration Properties .

4. Click SyncMaxWaitTime.

5. In the Value field, specify a value in seconds.

6. Click Apply.

7. Click Return.

7.3.2 What You May Need to Know About SyncMaxWaitTime and Synchronous Requests Not Timing Out

The SyncMaxWaitTime property applies to durable processes that are called in an asynchronous manner. Assume you have a BPEL process with the definition shown in Example 7–6 . The process is not durable because there are no breakpoint activities. Example 7–6 Process with No Breakpoint Activities receive name=receiveInput partnerLink=client variable=input createInstance=yes assign ... assign reply name=replyOutput partnerLink=client variable=output If a Java client or another BPEL process calls this process, the assign activity is performed and the reply activity sets the output message into a HashMap for the client actually the delivery service to retrieve. Since the reply is the last activity, the thread returns to the client side and tries to pick up the reply message. Since the reply message was previously inserted, the client does not wait and returns with the reply. Assume you have a BPEL process with a breakpoint activity, as shown in Example 7–7 . Example 7–7 Process with Breakpoint Activities receive name=receiveInput partnerLink=client variable=input Invoking a Synchronous Web Service from a BPEL Process 7-7 createInstance=yes assign ... assign wait for=PT10S reply name=replyOutput partnerLink=client variable=output While it is not recommended to have asynchronous activities inside a synchronous process, BPEL does not prevent this type of design. When the client or another BPEL process calls the process, the wait breakpoint activity is executed. However, since the wait is processed after some time by an asynchronous thread in the background, the executing thread returns to the client side. The client actually the delivery service tries to pick up the reply message, but it is not there since the reply activity in the process has not yet executed. Therefore, the client thread waits for the SyncMaxWaitTime seconds value. If this time is exceeded, then the client thread returns to the caller with a timeout exception. If the wait is less than the SyncMaxWaitTime value, the asynchronous background thread then resumes at the wait and executes the reply. The reply is placed in the HashMap and the waiter the client thread is notified. The client thread picks up the reply message and returns. Therefore, SyncMaxWaitTime only applies to synchronous process invocations when the process has a breakpoint in the middle. If there is no breakpoint, the entire process is executed by the client thread and returns the reply message.

7.4 Calling a One-Way Mediator with a Synchronous BPEL Process

You can expose a synchronous interface in the front end while using an asynchronous callback in the back end to simulate a synchronous reply. This is the default behavior in BPEL processes with the automatic setting of the configuration.transaction property to requiresNew in the composite.xml file. Example 7–8 provides details. Example 7–8 configuration.transaction Property component name=BPELProcess1 implementation.bpel src=BPELProcess1.bpel property name=configuration.transaction type=xs:string many=falserequiresNewproperty component RequiresNew is the recommended value. If you want to participate in the clients transaction, you must set the configuration.transaction property to Required. 7-8 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite