Introduction to Invoking a Synchronous Web Service

Invoking a Synchronous Web Service from a BPEL Process 7-3 Figure 7–2 CreditCardAuthorizationService Partner Link Figure 7–3 shows the InvokeCheckCreditCard invoke activity. Figure 7–3 InvokeCheckCreditCard Invoke Activity

3. The Switch_EvaluateCCResult switch activity in

Figure 7–1 checks the results of the credit card validation. For information about switch activities, see Section 10.2.1, Defining Conditional Branching with the Switch Activity in BPEL 1.1. Note: The switch activity is replaced by the if activity in BPEL 2.0. 7-4 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

7.2.2 What Happens When You Invoke a Synchronous Web Service

When you create a partner link and invoke activity, the necessary BPEL code for invoking a synchronous web service is added to the appropriate BPEL and Web Services Description Language WSDL files.

7.2.2.1 Partner Link in the BPEL Code

In the OrderProcessor.bpel code, the partner link defines the link name and type, and the role of the BPEL process service component in interacting with the partner service. From the BPEL source code, the CreditCardAuthorizationService partner link definition is shown in Example 7–1 : Example 7–1 Partner Link Definition partnerLink name=CreditCardAuthorizationService partnerRole=CreditAuthorizationPort partnerLinkType=ns2:CreditCardAuthorizationService Variable definitions that are accessible locally in the Scope_AuthorizeCreditCard scope are shown in Example 7–2 . The types for these variables are defined in the WSDL for the process itself. Example 7–2 Variable Definition variable name=lCreditCardInput messageType=ns2:CreditAuthorizationRequestMessage variable name=lCreditCardOutput messageType=ns2:CreditAuthorizationResponseMessage The WSDL file defines the interface to your BPEL process service component: the messages that it accepts and returns, the operations that are supported, and other parameters.

7.2.2.2 Partner Link Type and Port Type in the BPEL Code

The web service’s CreditCardAuthorizationService.wsdl file contains two sections that enable the web service to work with BPEL process service components: ■ partnerLinkType: Defines the following characteristics of the conversion between a BPEL process service component and the credit card authorization web service: – The role operation played by each – The portType provided by each for receiving messages within the conversation ■ portType: A collection of related operations implemented by a participant in a conversation. A port type defines which information is passed back and forth, the form of that information, and so on. A synchronous invocation requires only one port type that both initiates the synchronous process and calls back the client with the response. An asynchronous callback one in which the reply is not immediate requires two port types, one to send the request, and another to receive the reply when it arrives.