Time for action – initializing a dynamic partner link

Carry out the following steps:

  1. Create a new local variable named partnerlink_reference. The schema of this variable is an element called service-ref, which is defined in Service Reference Schema for WS-BPEL 2.0 (http://docs.oasis-open.org/wsbpel/2.0/serviceref). This element is used as an envelope to wrap the endpoint reference of a partner link. Here, we use WS-Addressing schema (http://schemas.xmlsoap.org/ws/2004/08/addressing) to represent an endpoint reference, as shown in the following screenshot:
    Time for action – initializing a dynamic partner link

    Note

    In the sample repository, these schema files (ws_addressing.xsd and ws-bpel_serviceref.xsd) have been already included within the project directory.

  2. Drag-and-drop a new assign activity in between the <assign> activity named initialize_input_variable and the <invoke> activity named invoke_search_web_service. This assign activity is used to initialize the variable that holds the endpoint data and then that value is assigned to the partner link, as shown in the following screenshot:
    Time for action – initializing a dynamic partner link
  3. Double-click on the newly added <assign> activity and go to the Copy Rules tab, which allows you to define data manipulation rules.
  4. Initialize the local variable named partnerlink_reference with a literal value as follows:
    <sref:service-ref xmlns:sref="http://docs.oasis-open.org/wsbpel/2.0/serviceref">
        <EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:ns1="http://oracle. com/sca/soapservice/Fault_Handling_And
           _Signalling_Application/Fault_Handling_And_Signalling_Project/SearchService">
            <ServiceName>ns1:search_bookstore</ServiceName>
        </EndpointReference>
    </sref:service-ref> 
  5. Append the counter value of the <forEach> loop to the child element named ServiceName of partnerlink_reference, as follows:
    Time for action – initializing a dynamic partner link
  6. We have modified the endpoint values in the partnerlink_reference variable and we can assign it to the partner link named bookstore_search_partner_link. We can do that by just adding another copy rule to the <assign> activity named initialize_partnerlink_reference. Add another copy rule by connecting the partnerlink_reference variable to the partner link named bookstore_search_partner_link, as shown:
    Time for action – initializing a dynamic partner link

What just happened?

In the preceding section, we focused on using a dynamic partner link to invoke the external web service. First, we create a new local variable named partnerlink_reference that can handle partner link data. Then, we create another <assign> activity that is used to initialize and assign endpoints to the partnerlink_reference variable. Then we initialize that variable and assigned a dynamic endpoint based on the counter value of the <forEach> activity. Finally, we assign the value of the partnerlink_reference variable to the partner link named bookstore_search_partner_link.

Constructing the response variable of the BPEL process

We have implemented the BPEL process up to the external service invocation. The remaining task is to combine all the responses from external web services to the response variable of the BPEL process, so the response message consists of data extracted from each bookstore relevant to the book specified by the request message to the BPEL process. For this task, we use a new <assign> activity after the added <invoke> activity and simply append the string returned by the <invoke> activity to the output variable of the BPEL process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.48.181