Adding a Receive Activity

8-6 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite payload into the loan application approver web service’s request variable payload. ■ Create a second assign activity for data manipulation after the receive activity that copies the loan application approver web service’s response variable loan application results payload into the output variable for the client to receive.

8.2.2 What Happens When You Invoke an Asynchronous Web Service

This section describes what happens when you invoke an asynchronous web service.

8.2.2.1 portType Section of the WSDL File

The portType section of the WSDL file in this example, for LoanService defines the ports to be used for the asynchronous service. Asynchronous services have two port types. Each port type performs a one-way operation. In this example, one port type responds to the asynchronous process and the other calls back the client with the asynchronous response. In the example shown in Example 8–1 , the portType LoanServiceCallback receives the client’s loan application request and the portType LoanService asynchronously calls back the client with the loan offer response. Example 8–1 portType Definition -- portType implemented by the LoanService BPEL process -- portType name=LoanService operation name=initiate input message=tns:LoanServiceRequestMessage operation portType -- portType implemented by the requester of LoanService BPEL process for asynchronous callback purposes -- portType name=LoanServiceCallback operation name=onResult input message=tns:LoanServiceResultMessage operation portType

8.2.2.2 partnerLinkType Section of the WSDL File

The partnerLinkType section of the WSDL file in this example, for LoanService defines the following characteristics of the BPEL process service component: ■ The role operation played ■ The portType provided for receiving messages within the conversation Partner link types in asynchronous services have two roles: one for the web service provider and one for the client requester. In the conversation shown in Example 8–2 , the LoanServiceProvider role and LoanService portType are used for client request messages and the LoanServiceRequester role and LoanServiceCallback portType are used for asynchronously returning calling back response messages to the client. Example 8–2 partnerLinkType Definition plnk:partnerLinkType name=LoanService plnk:role name=LoanServiceProvider Invoking an Asynchronous Web Service from a BPEL Process 8-7 plnk:portType name=client:LoanService plnk:role plnk:role name=LoanServiceRequester plnk:portType name=client:LoanServiceCallback plnk:role plnk:partnerLinkType Two port types are combined into this single asynchronous BPEL process service component: portType=services:LoanService of the invoke activity and portType=services:LoanServiceCallback of the receive activity. Port types are essentially a collection of operations to be performed. For this BPEL process service component, there are two operations to perform: initiate in the invoke activity and onResult in the receive activity.

8.2.2.3 Partner Links Section in the BPEL File

To call the service from BPEL, you use the BPEL file to define how the process interfaces with the web service. View the partnerLinks section. The services with which a process interacts are designed as partner links. Each partner link is characterized by a partnerLinkType. Each partner link is named. This name is used for all service interactions through that partner link. This is critical in correlating responses to different partner links for simultaneous requests of the same type. Asynchronous processes use a second partner link for the callback to the client. In this example, the second partner link, LoanService, is used by the loan application approver web service. Example 8–3 provides an example. Example 8–3 partnerLink Definition -- This process invokes the asynchronous LoanService. -- partnerLink name=LoanService partnerLinkType=services:LoanService myRole=LoanServiceRequester partnerRole=LoanServiceProvider partnerLinks The attribute myRole indicates the role of the client. The attribute partnerRole role indicates the role of the partner in this conversation. Each partnerLinkType has a myRole and partnerRole attribute in asynchronous processes.

8.2.2.4 Composite Application File

In the composite.xml file, the loan application approver web service appears, as shown in Example 8–4 . Example 8–4 Loan Application Approver Web Service component name=LoanBroker implementation.bpel process=LoanBroker.bpel component For more information, see Section 8.2.1.1, Adding a Partner Link for an Asynchronous Service for instructions on creating a partner link.