In this section, you learn how to:
To design the Parallel node to interact with the price and availability Web services, complete the following tasks:
To Create Instances of the PriceProcessor and AvailProcessor Controls in Your Project
The Web service controls (PriceProcessorControl.jcx and AvailProcessorControl.jcx) are provided for you in your application's project (specifically in myapplications\Tutorial_Process_Application\Tutorial_Process_ApplicationWeb\requestquote\services folder, where myapplications represents the location at which you created your tutorial application). The goal of this section is to describe how to create the appropriate controls in your application, and then design the communication between your business process and these controls.
The Insert Control dialog box closes and an instance of the Web Service control is created in your project and displayed in the Data Palette.
The availProcessor Web Service control instance is added to the Data Palette:
To Add Control Nodes to Your Business Process
You learned in Parts I and II that you can create Control nodes in your business process by dragging the methods from the appropriate control on the Data Palette onto the business process in the Design View. You can also create Control nodes by selecting Control Send, Control Receive, or Control Send with Return from the Palette and dragging them onto the business process. You subsequently bind the appropriate methods to the control node you created. In this section you will use the latter approach.
Add the following nodes from the Palette to each branch on your Parallel node:
In Design View, select each of the listed nodes, then drag and drop the node onto the business process, placing the nodes on the Parallel branches until you create a Parallel group as shown in the following figure:
In this way, each branch is designed for the following flow of execution:
To Design the Activities on the Get Price Branch
To Design the Request Price Node
The Method panel is populated with a list of the asynchronous send methods you can invoke on the priceProcessor control.
By default, the Send Data tab opens on the Variable Assignment pane. (The Control Expects field is populated with the data type expected by the getPrice() method exposed by the priceProcessor Web service: int itemID.)
Note: The priceProcessor service takes the ID of the item requested as input, and returns the price of the widget.
Note: In this case, you must switch modes because the data type required as input to the priceProcessor control is int, and the iter_forEach1 variable, which holds the value of widgetId in the For Each loop, is of type XML (WidgetRequestDocument valid against an XML Schema).
The iteration variable was created for you when you specified the repeating element over which the For Each loop iterates. At run time, it holds the current widgetRequest element—that is, the one currently being processed in the For Each loop. (See Design a For Each Loop in Your Business Process.)
The Transformation tool opens and displays a representation of the iter_forEach1 (widgetRequest) variable in the Source pane, and an int in the Target pane.
As you draw the line in the map pane, WebLogic Workshop will display the following warning:
The datatype of the source node: [widgetId] and target node: [int] do not match, a type conversion will be applied.
Note: Creating this transformation creates a new method under the RequestQuoteTransformation.dtf already created in your project and prebuilt for you in the tutorial application. It is available in the Tutorial_Process_ApplicationWeb\requestquote folder. A new XQ file, which contains the query for this transformation method, is also created. See Note About Transformations.
To Design the Receive Price Node
The Method panel is populated with a list of the asynchronous receive methods on the priceProcessor control.
void returnPrice(int itemID,float price)
The Control Returns field is populated with the data types returned by the returnPrice(int itemID, float price) method on the priceProcessor Web service.
The PriceProcessor service takes the itemID (an int) as input and returns an int and a float—containing values for the itemID and the price, respectively.
In this case, you must switch from the Variable Assignment mode displayed in the preceding figure to the Transformation mode because you want to assign the data returned by the priceProcessor service to a variable of type XML. To do so, your business process must transform the Java data types returned from the priceProcessor service to typed XML.
itemID to widgetId
price to price
Note: Creating this transformation creates a new method under the RequestQuoteTransformation.dtf already created in your project and prebuilt in the tutorial application. It is available in the Tutorial_Process_Application\Webrequestquote folder. A new XQ file, which contains the query for this transformation method, is also created.
To Design the Create PriceList Node
In this step, you use a Transformation control (PriceAvailTransformations) provided in your project to append the price data returned from the priceProcessor control (on each iteration through the For Each loop) to a single variable.
Previously, when you designed nodes in the business process, you created transformation methods on a Transformation as necessary to map the data your business process sent to or received from clients and controls. In this case, you also use a Transformation, but in a different way. In the case of the Create PriceList node, the data is not sent to a client or control. Instead, the Transformation takes, as input from your business process, typed XML data and returns untyped XML (XmlObject). The business process must append the data returned on every iteration of the For Each loop to a single variable, thus creating a repeating sequence of XML data. A variable that can hold this type of repeating sequence of XML data in a For Each loops is of type XmlObjectList. Both typed and XmlObject variables can be appended to variables of type XmlObjectList. (See Note About Using the XmlObjectList Data Type.)
Note: This transformation is prebuilt for you in the tutorial application. It is available in the Tutorial_Process_Application\Webrequestquote folder.
A description of how to create the PriceAvailTransform.dtf file is beyond the scope of this tutorial. To learn more about Transformations, see Note About Transformations.
To Create an Instance of the PriceAvailTransformations Control in Your Project
To Design the Interaction of the Create PriceList Node With the Transformation
XmlObject convertPriceXMLtoXMLObj(org.example.price.PriceRequestDocument _priceRequestDoc)
XmlObject convertPriceXMLtoXMLObj(org.example.price.PriceRequestDocument _priceRequestDoc)
The Control Expects field is populated with the data type and name of the parameter expected by the convertPriceXMLtoXMLObj() method on the priceAvailTransformations control: PriceRequestDocument _priceRequestDoc.
In this case, note that the data type of your price variable (PriceRequestDocument) matches that of the data expected by the priceAvailTransformations.
The Control Returns field is populated with the data type of the parameter returned by the convertPriceXMLtoXMLObj() method on the priceAvailTransformations control: XmlObject.
An XmlObject is a Java data type that specifies data in untyped XML format. In other words, this data type represents XML data that is not valid against an XML Schema.
The priceList variable is created and assigned to receive the XmlObject data returned by the priceProcessor service.
This step completes the design of the Get Price branch on the Parallel node. At run time, by executing this branch, your business process appends the XmlObject, which contains the data returned by the priceProcessor control (during the current iteration through the For Each loop), to the priceList variable.
To Design the Activities on the Get Availability Branch
To Design the Request Availability Node
The Method panel is populated with a list of the asynchronous send methods you can invoke on the availProcessor control.
void getAvail(int itemID, int quantity)
By default, the Send Data tab opens on the Variable Assignment pane. The Control Expects field is populated with the data types and names of the parameters expected by the getAvail() method exposed by the availProcessor Web service: int itemID and int quantity.
Note: The availProcessor service takes, as input, the itemID (int) and the quantity (int) requested by the client. It returns the itemID (int), the quantity available (int), a boolean to indicate whether the widgets are in stock, and a ship date (String).
Note: In this case, you must switch modes because you must transform the data you input to availProcessor. The availProcessor control requires its input as int data types, and the iter_forEach1 variable, which holds the value of widgetId and quantity in the For Each loop, is of type XML (WidgetRequestDocument valid against an XML Schema).
The Transformation tool opens and displays a representation of the iter_forEach1 variable in the Source pane, and the integer arguments to the availProcessor transformation method in the Target pane.
widgetID to itemID
quantity to quantity
A line is drawn between the elements in the map pane. It represents the transformation between the data types.
Note: Creating this transformation creates a new method under the RequestQuoteTransformation.dtf already created in your project and prebuilt in the tutorial application. It is available in the Tutorial_Process_ApplicationWeb/requestquote folder. A new XQ file, which contains the query for this transformation method, is also created.
This step completes the design of the Request Availability node.
To Design the Receive Availability Node
The Method panel is populated with a list of the asynchronous receive methods on the availProcessor control.
void avail(int itemID, int qty, boolean avail, String date)
The Control Returns fields are populated with the data types and names of the parameters returned by the avail(int itemID, int qty, boolean avail, String date) method on the availProcessor Web service.
Note: In this case, you must switch from the Variable Assignment mode to the Transformation mode on the Receive Data tab because you want to assign the data returned by the availProcessor service to a variable of type XML. To do so, your process must transform the Java data types returned to typed-XML.
itemID to widgetId
qty to requestedQuantity
avail to quantityAvail
date to shipDate)
Note: Creating this transformation creates a new method under the RequestQuoteTransformation.dtf already created in your project and prebuilt in the tutorial application. It is available in the requestquote\Tutorial_Process_ApplicationWeb folder. A new XQ file, which contains the query for this transformation method, is also created.
This step completes the design of the Receive Availability node.
To Design the Create AvailList Node
In the same way as you designed the business process to append the price data to a single variable when you designed the Get Price branch of the Parallel node, in this step, you call a method on the priceAvailTransformations control to append the availability data returned to a single variable, of type XmlObjectList. (See Note About Using the XmlObjectList Data Type.)
XmlObject convertAvailXMLtoXMLObj(org.example.avail.AvailRequestDocument _availRequestDoc)
XmlObject convertAvailXMLtoXMLObj(org.example.AvailRequestDocument _availRequestDoc)
The Control Expects field is populated with AvailRequestDocument, which is the data type expected by the convertAvailXMLtoXMLObj(org.example.avail.AvailRequestDocument _availRequestDoc) method on the priceAvailTransformations control.
In this case, note that the data type of your avail variable (AvailRequest) matches that of the data expected by the priceAvailTransformations control.
The Control Returns field is populated with XmlObject, which is the data type returned by the convertAvailXMLtoXMLObj() method on the priceAvailTransformations control.
An XmlObject is a Java data type that specifies data in untyped XML format. In other words, this data type represents XML data that is not valid against an XML Schema.
The availList variable is created and assigned to receive the XmlObject data returned by the availProcessor service.
This step completes the design of the Get Availability branch on the Parallel node. At run time, by executing this branch, your business process appends the XmlObject, which contains the data returned by the availProcessor control (during the current iteration through the For Each loop), to the availList variable.
Note About Using the XmlObjectList Data Type
On each iteration through the For Each loop, the priceProcessor service returns price data, which is assigned to the price variable; and the availProcessor service returns availability data, which is assigned to the avail variable. Your business process must collect the price data returned on each iteration and create a list of price data; one item is assigned to the list for each iteration through the loop. Similarly, a list of availability data is created on the Get Availability branch of the Parallel node for each iteration through the loop.
An XmlObjectList is a Java data type that specifies a sequence of untyped XML format data. In other words, this data type represents a sequence of XML elements (a set of repeating elements). As the final step of each iteration through the Get Price branch in your Parallel node, your business process assigns the data from the price variable to the priceList variable (of type XmlObjectList). In this way, a single variable holds the price data for each of the widgets in the Request for Quote over which the For Each loop iterates. In the same way, a single variable holds the availability data for each widget.
To learn how the XmlObjectList variable is used, see To Design the Create PriceList Node and To Design the Create AvailList Node.
Understanding Parallel Execution in Your Business Process
![]() |
![]() |