emp xsi:type=ManagerType firstNamePeterfirstNamelastNameSmithlastName Using Element Variables in Message Exchange Activities in BPEL 2.0

Manipulating XML Data in a BPEL Process 6-33 sequence complexType element element name=processResponse complexType sequence element name=payload type=string maxOccurs=unbounded sequence complexType element schema The from variable contains the content shown in Example 6–67 . Example 6–67 Variable Content ns1:process xmlns:ns1=http:xmlns.oracle.comEvent_jwsEventEventTest ns1: payload ans1: payload ns1: payload bns1: payload ns1:process The to variable contains the content shown in Example 6–68 . Example 6–68 Variable Content ns1:processResponse xmlns:ns1=http:xmlns.oracle.comEvent_ jwsEventEventTest ns1: payload cns1: payload ns1:process The bpelx:copyList operation looks as shown in Example 6–69 . Example 6–69 bpelx:copyList assign bpelx:copyList bpelx:from variable=inputVariable part=payload query=client:processclient:payload bpelx:to variable=outputVariable part=payload query=client:processResponseclient:payload bpelx:copyList assign This makes the to variable as shown in Example 6–70 . Example 6–70 Variable Content ns1:processResponse xmlns:ns1=http:xmlns.oracle.comEvent_ jwsEventEventTest ns1: payload ans1: payload ns1: payload bns1: payload ns1:process

6.14.6.2 bpelx:copyList in BPEL 2.0

Example 6–71 provides an example of bpelx:copyList syntax in a BPEL project that supports BPEL version 2.0. In BPEL 2.0, the functionality is the same as described in Section 6.14.6.1, bpelx:copyList in BPEL 1.1, but the syntax is slightly different. An extensionAssignOperation element wraps the bpelx:copyList extension. 6-34 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Example 6–71 bpelx:copyList Extension in BPEL 2.0 assign extensionAssignOperation bpelx:copyList bpelx:frominputVariable.payloadclient:payloadbpelx:from bpelx:tooutputVariable.payloadclient:payloadbpelx:to bpelx:copyList extensionAssignOperation assign

6.14.7 How to Use Assign Extension Attributes

You can assign the following attributes to copy rules in an assign activity. ■ ignoreMissingFromData ■ insertMissingToData ■ keepSrcElementName At the bottom of the Copy Rules tab of an assign activity, you right-click a selected copy rule to display a menu for choosing the appropriate attribute. Figure 6–10 provides details. Figure 6–10 Assign Extension Attributes

6.14.7.1 ignoreMissingFromData Attribute

The ignoreMissingFromData attribute suppresses any bpel:selectionFailure standard faults. Table 6–3 describes the syntax differences between BPEL versions 1.1 and 2.0.

6.14.7.2 insertMissingToData Attribute

The insertMissingToData attribute instructs runtime to complete the XPath L-value specified by the to-spec, if no items were selected. Table 6–4 describes the syntax differences between BPEL versions 1.1 and 2.0. Table 6–3 ignoreMissingFromData Attribute Syntax BPEL 1.1 BPEL 2.0 copy bpelx:ignoreMissingFromData=yes|no copy ignoreMissingFromData=yes|no Table 6–4 insertMissingToData Attribute Syntax BPEL 1.1 BPEL 2.0 copy bpelx:insertMissingToData=yes|no copy bpelx:insertMissingToData=yes|no Manipulating XML Data in a BPEL Process 6-35

6.14.7.3 keepSrcElementName Attribute

The keepSrcElementName attribute enables you to replace the element name of the destination as selected by the to-spec with the element name of the source. This attribute was not implemented in BPEL 1.1. Table 6–5 describes the syntax supported in BPEL version 2.0.

6.15 Validating XML Data

You can verify code and identify invalid XML data in a BPEL project.

6.15.1 How to Validate XML Data in BPEL 1.1

■ In an assign activity in Oracle BPEL Designer:

1. From the BPEL Constructs section of the Component Palette, drag an Assign

activity into the designer.

2. Double-click the Assign activity.

3. In the General tab, enter a name for the activity and select the Validate

checkbox.

4. Click Apply, then OK.

5. Click the Source tab to view the syntax.

assign name=Assign1 bpelx:validate=yes . . . assign ■ In a standalone, extended validate activity in Oracle BPEL Designer that can be used without an assign activity:

1. From the Oracle Extensions section of the Component Palette, drag a Validate

activity into the designer.

2. Double-click the Validate icon.

3. Enter a name for the activity.

4. Click the Add icon to select the variable to validate.

5. Select the variable, then click OK.

6. Click Apply, then OK.

7. Click the Source tab to view the syntax.

bpelx:validate name=Validate1 variables=inputVariable

6.15.2 How to Validate XML Data in BPEL 2.0

■ In an assign activity in Oracle BPEL Designer:

1. From the BPEL Constructs section of the Component Palette, drag an Assign

activity into the designer.

2. Double-click the Assign activity.

Table 6–5 keepSrcElementName Attribute Syntax BPEL 1.1 BPEL 2.0 Not implemented copy keepSrcElementName=yes|no 6-36 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

3. In the General tab, enter a name for the activity and select the Validate

checkbox.

4. Click Apply, then OK.

5. Click the Source tab to view the syntax. Note that the syntax for validating

XML data with the assign activity is slightly different between BPEL versions 1.1 and 2.0. assign name=Assign1 validate=yes . . . assign ■ In a standalone, extended validate activity in Oracle BPEL Designer that can be used without an assign activity:

1. From the BPEL Constructs section of the Component Palette, drag a Validate

activity into the designer.

2. Double-click the Validate icon.

3. Enter a name for the activity.

4. Click the Add icon to select the variable to validate.

5. Select the variable, then click OK.

6. Click Apply, then OK.

7. Click the Source tab to view the syntax. Note that the syntax for validating

XML data with the validate activity is slightly different between BPEL versions 1.1 and 2.0. validate name=Validate1 variables=inputVariable

6.16 Using Element Variables in Message Exchange Activities in BPEL 2.0

You can specify variables in the following message exchange activities: ■ The Input field for an inputVariable attribute and Output field for an outputVariable attribute of an invoke dialog ■ The Input field for a variable attribute of a receive activity ■ The Output field for a variable attribute of a reply activity The variables referenced by these fields typically must be message type variables in which the QName matches the QName of the input and output message types used in the operation, respectively. The one exception is if the WSDL operation in the activity uses a message containing exactly one part that is defined using an element. In this case, a variable of the same element type used to define the part can be referenced by the inputVariable and outputVariable attributes, respectively, in the invoke activity or the variable attribute of the receive or reply activity. Using a variable in this situation must be the same as declaring an anonymous, temporary WSDL message variable based on the associated WSDL message type. Copying element data between the anonymous, temporary WSDL message variable and the element variable acts as a single virtual assign with one copy operation whose keepSrcElementName attribute is set to yes. The virtual assign must follow the same rules and use the same faults as a real assign activity. Table 6–6 provides details. Manipulating XML Data in a BPEL Process 6-37 For more information about the keepSrcElementName attribute, see Section 6.14.7.3, keepSrcElementName Attribute.

6.17 Mapping WSDL Message Parts in BPEL 2.0

The toParts element in invoke and reply activities provides an alternative to explicitly creating multipart WSDL messages from the contents of BPEL variables. When you use the toParts element, as shown in Example 6–72 , an anonymous, temporary WSDL variable is defined based on the type specified by the input message of the appropriate WSDL operation. Example 6–72 toParts Element toParts toPart part=payload fromVariable=request toParts The toParts element acts as a single, virtual assign activity. Each toPart acts as a copy operation. One toPart at most exists for each part in the WSDL message definition. Each copy operation copies data from the variable specified in the fromVariable attribute into the part of the anonymous, temporary WSDL variable referenced in the part attribute of the toParts element. The fromParts element in receive activities, invoke activities, the onEvent branch of scope activities, and the onMessage branch of pick activities is similar to the toParts element. The fromParts element, as shown in Example 6–73 , retrieves data from an incoming multipart WSDL message and places the data into individual variables. Example 6–73 fromParts Element fromParts fromPart part=payload toVariable=request fromParts When a WSDL message is received on an invoke activity that uses fromParts elements, the message is placed in an anonymous, temporary WSDL variable of the type specified by the output message of the appropriate WSDL operation. As with the toParts element, the fromParts element acts as a single virtual assign activity. Each fromPart acts as a copy operation. Each copy operation copies the data at the part of the anonymous, temporary WSDL variable referenced in the part attribute of the fromPart into the variable indicated in the toVariable attribute. Table 6–6 Mapping WSDL Message Parts For The... The... inputVariable attribute Value of the variable referenced by the attribute sets the value of the part in the anonymous temporary WSDL message variable. outputVariable attribute Value of the received part in the temporary WSDL message variable sets the value of the variable referenced by the attribute. Receive activity Incoming part’s value sets the value of the variable referenced by the variable attribute. Reply activity Value of the variable referenced by the variable attribute sets the value of the part in the anonymous, temporary WSDL message variable that is sent out. For a reply activity sending a fault, the same scenario applies. 6-38 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite For both the toParts and fromParts elements, the virtual assign activity must follow the same semantics and generate the same faults as a real assign activity. The presence of a fromParts element in an invoke activity does not require it to have a fromPart for every part in the WSDL message definition. Parts not explicitly represented by fromParts elements are not copied from the anonymous WSDL variable to the variable. For more information about mapping WSDL message parts with the toParts and fromParts elements, see the Web Services Business Process Execution Language Version 2.0 Specification located at the following URL: http:www.oasis-open.org

6.17.1 How to Map WSDL Message Parts

This section provides an overview of a simple BPEL process in which a reply activity uses the toParts elements to copy variable contents. The WSDL and BPEL files used in this example are shown later in Example 6–74 and Example 6–75 of Section 6.17.2, What Happens When You Map WSDL Message Parts. How to map WSDL message parts in BPEL 2.0 1. Note the receive activity in Figure 6–11 includes a standard inputVariable variable from the client. Figure 6–11 Receive Activity

2. Note the assign activity in

Figure 6–12 copies the test-type-variable contents to Var1 . Manipulating XML Data in a BPEL Process 6-39 Figure 6–12 Assign Activity

3. Note that the To Parts button at the bottom of the reply activity is enabled in

Figure 6–13 , instead of the Variable button. You create information for this section by clicking the Add icon. The copy operation copies data from the variable indicated in the From Variable attribute, Var1, into the part of the anonymous, temporary WSDL variable referenced in the Part attribute. Figure 6–13 To Parts Section Defined at Bottom of Reply Activity

6.17.2 What Happens When You Map WSDL Message Parts

Example 6–74 shows a .bpel file for a synchronous request with toPart elements defined in a reply activity. This maps to the operation defined in the WSDL file shown in Example 6–75 . The copy operation copies data from the variable indicated in the fromVariable attribute into the part of the anonymous, temporary WSDL variable, Var1. Example 6–74 BPEL File with ToParts Elements sequence name=main -- Receive input from requestor. This maps to operation defined in WSDL -- receive name=receiveInput partnerLink=test_client portType=client:Test operation=process variable=inputVariable createInstance=yes -- Generate reply to synchronous request --