Adding Correlations to an Activity
For a discussion of using engine-managed correlation versus correlation sets, see
Correlation Sets and Engine-Managed Correlation.
You can add correlations to the following kinds of Web service interaction activities:
- •Receive
- •Pick (onMessage branch)
- •Event handler (onEvent variant)
- •Invoke
- •Reply
After you add correlation to an activity and save your process file, the Problems view shows warning messages for the related activities that should be correlated.
For a discussion of correlation attributes that you must set, see
Initiating and Setting Patterns for Correlation.
Initiating and Setting Patterns for Correlation
Add a correlation set to an activity.
Each usage of a correlation set on an activity requires the setting of an initiate attribute. In addition, for an invoke activity, there is a pattern attribute.
Initiate Attribute
The initiate attribute can be yes, no, or join.
A yes means that the execution of the activity initializes the correlation set property alias with a value from the message being sent or received. WS-BPEL requires the activity to fault with the standard bpel:correlationViolation fault if the correlation set is already initiated.
If there are multiple activities enabled concurrently, and any of them could initiate the correlation set, you should use the join attribute.
A join means an activity must attempt to initiate the correlation set. Join is useful for multi-start activities or any scenario where more than one activity can initiate the correlation set.
The following sections describe different activity types.
Receive OnMessage and OnEvent
These activities receive messages.
If the correlation initiate attribute is yes and the correlation set is currently empty, the process accepts any message that matches the participant and operation for these activities. After receiving a message, the correlation set is initiated. If the correlation set had already been initiated from a previous Web service interaction, then the process accepts a message for this activity only if it matches the correlation properties in addition to the participant and operation.
Reply
A reply transmits data.
- •If its correlation initiate attribute is set to yes, the correlation set is initiated with the values from the message being transmitted.
- •If it is set to no then the message is validated against the values currently in the correlation set to ensure that the message is being transmitted with the correct data.
Invoke
An invoke transmits data and can also receive a response from the target Web service.
The invoke activity adds an additional attribute to the correlation usage to account for its dual nature. The pattern attribute describes when the correlation set should be used.
- •If it is set to request, it applies only to the outbound message. In this case the input variable for the invoke is validated against the correlation set to ensure that the correct data is being transmitted.
- •If it is set to response, it ensures that the output variable populated from the invoked Web service matches the data in the correlation set.
If it is set to request-response, the data is validated on the way out and the way in.
If a correlation set is used prior to its initiation (that is, the initiate attribute is no) the BPEL engine throws a bpel:correlationViolation fault. This error is also thrown if a correlation set tries to validate the transmission of data that does not match.
The syntax for a correlation set is as follows:
<correlation set="NCName"
initiate="yes|join|no"?
pattern="request|response|request-response"? />+
Adding Correlation to a Receive, OnMessage, OnEvent, or Reply
Add a correlation set to an activity.
For a discussion of using engine-managed correlation vs. correlation sets, see
Adding a Correlation Set. For help initiating correlation, see
Correlation Sets and Engine-Managed Correlation.
Before adding correlation to an activity, create a correlation set. For more information, see
Adding a Correlation Set.
- 1. On the Process Editor canvas, select a Receive, OnMessage branch of a Pick activity, OnEvent variant of an Event Handler, or Reply.
- 2. In the Properties view, click Dialog (...).
- 3. Select a correlation set from the list.
- 4. Select one of the following from the Initiate list:
- - Yes to start correlation in this activity.
- - Join to start correlation in this activity if it has not yet started. This is useful for multi-start activities such as several receives inside a flow or scope. Select Join for each receive.
- - No if this activity does not initiate correlation.
- 5. If needed, click Add to add another correlation set for this activity.
- 6. If needed, reorganize a correlation set by moving it up or down in the list. The order of correlation sets is not significant for processing. Organize the list as you prefer.
Example
<receive createInstance="yes" name="SellerReceive"
operation="submit" partnerLink="seller"
variable="sellerInfo" >
<correlations>
<correlation initiate= "yes" set="negotiationIdentifier"/>
</correlations>
</receive>
Adding Correlation to an Invoke Activity
Add a correlation set to an activity.
Before adding correlation to an activity, create a correlation set. For more information, see
Adding a Correlation Set. For additional help, see
Initiating and Setting Patterns for Correlation for Correlation and
Invoke.
If the Invoke activity has a both input and output messages, you must select a pattern for the correlation set. If an Invoke activity has only an input message, correlation serves only to validate the outbound message.
- 1. On the Process Editor canvas, select an Invoke activity.
- 2. In the Properties view, click Dialog (...).
- 3. Select a correlation set from the list.
- 4. Select one of the following from the Initiate list:
- - Yes to start correlation in this activity.
- - Join to start correlation in this activity, if it has not started yet. This is useful for multi-start activities, such as several receives inside a flow or scope. Select Join for each receive.
- - No if this activity does not initiate correlation.
- 5. Se Pattern to one of the following:
- - Request to correlate the input message.
- - Response to correlate the output message
- - Request-Response to correlate both messages. This is useful when both the input and the output message are part of the same conversation, and both contain a property alias for the same property.
- 6. If needed, click Add to add another correlation set for this activity.
Example
<invoke partnerLink="Seller" operation="SyncPurchase"
inputVariable="sendPO"
outputVariable="getResponse">
<correlations>
<correlation initiate="yes" set="PurchaseOrder"
pattern="request">
<correlation initiate="yes" set="Invoice"
pattern="response">
</correlations>
</invoke>
Adding Missing Correlation
Add a missing correlation set to an activity.
After you initiate correlation and save the BPEL file, Process Developer adds a warning to the Problems view for each activity in the process that should also include correlation.
To view the warnings, you must have warning tasks enabled in Window > Preferences > Process Developer > Tasks.