BPEL Designer: Understanding Correlation. Using the Correlation Wizard
See Also
The BPEL Service Engine runtime uses a mechanism called correlation to track the
multiple, stateful, long-running exchanges of messages that typically take
place between a
BPEL process and its partner services. A message in such a conversation is mapped to a composite value made up of one or more properties defined in a WSDL file.
Thus, correlation sets are used to support stateful collaboration between web services in a standardized, implementation independent way. Correlation sets rely on the correlation data tokens stored in the message envelopes, headers, or business documents themselves. The declaration of correlation relies on the declarative properties of messages. A property is a field within a message identified by a query. Queries are specified by special constructs called property aliases.
The following terms apply to correlation:
- A property is an abitrarily named token. It must be a simple type. It is defined in a WSDL file.
- A property alias is a rule that tells the BPEL runtime how to map data from a message into a property value. You can define several property aliases for a property that will be used as a correlation value. You would do this if the same property value needs to be mapped from more than one message, which is typical in correlation. For instance, if two different messages have the same part that you want to extract. Then you need one property and two property aliases - one for each message). Property aliases are defined in a WSDL file.
- A correlation set is a compound key made up of one or more property values, actually it is a property set. The BPEL runtime uses this key to ensure that messages are routed to the right process instance for a particular conversation. Correlation sets are defined in a BPEL file.
- Correlations mark the activities, they identify the correlation sets by name and indicate which correlation sets occur in the messages being sent or received.
Elements That Use and Express Correlation
Correlation sets can be defined for the Process element. The defined correlation sets are then used by message activities (Invoke, Reply, and Receive), which describe a conversation between a process and a partner service.
Correlation sets on Invoke activities are used to verify that
outbound messages contain data that is consistent with the data found
within specified correlation set instances.
Correlation set names are also used in the onMessage branches
of Pick elements and in the onEvent variant of eventHandlers.
Ways to define correlation:
- Use the Correlation wizard which will automatically perform all the main steps. This is the most easy and convenient way to define correlation. Usually you do not have to know in details how does correlation work. The Wizard will make it for you.
- Define correlation manually
Correlation Wizard is used to define correlations for two messaging activities, such as Invoke, Reply, Receive, OnEvent or onMessage branch of Pick element.
Note: The wizard only enables you to create correlation. You can't edit correlation in the wizard.
To create correlation using the Correlation Wizard:
- In the Design view, right click the activity that requires correlation and choose Define Correlation. The Correlation Wizard opens.
- Step 1. Select the messaging activity. From the drop-down list choose an initiating messaging activity. The activity chosen here will initiate the correlation set. Click Next.
- Step 2. Define the correlation. On the left you see a tree structure of the message that initiating activity sends or receives. On the right you see the structure of the message passed by the correlating activity. Connect the messages parts that should be used to define correlation by selecting the node in the source tree pane and dragging the pointer to the node in the destination tree pane.
- The correlation is set.
The Wizard will create properties and property aliases in a WSDL file, define a correlation set in BPEL, and associate the correlation set with the activities you chose.
Note that properties and property aliases are written to a new WSDL file that you can see among the process files of the BPEL Module. The original WSDL file for the partner service is imported to the new WSDL. For all correlation created using the Wizard, both properties and property aliases are written to this file. Partner WSDL files are imported.
The correlation set defined in the BPEL file refers to the new WSDL.
- See Also
- Adding Correlation Sets Manually
- Configuring Properties and Property Aliases Using the WSDL View
Legal Notices