Order Management
 Choreographies

Version 1.0

Date: 5/15/03

Table of Contents

1.0  Introduction
2.0   Order and Order Response Support
2.1 Order Only
2.2 Order with OrderResponse
2.3 Order with Multiple OrderResponses
3.0   Order and Cancel Order Support
3.1 Order with Cancel
3.2 Order with OrderResponse and Cancel
3.3 Order with Multiple OrderResponses and Cancel
4.0 Order and Change Order Support
4.1 Order with OrderResponse and ChangeOrder
4.2 Order with Multiple OrderResponses and ChangeOrder
4.3 Order with OrderResponse and Multiple ChangeOrders
4.4 Order with Multiple OrderResponse and Multiple ChangeOrder
5.0 Order with Change Order and Cancel Order Support
5.1 Order with OrderResponse and ChangeOrder and Cancel
5.2 Order with OrderResponse and Multiple ChangeOrder and Cancel
5.3 Order with Multiple OrderResponse and ChangeOrder and Cancel
5.4 Order with Multiple OrderResponse and Multiple ChangeOrder and Cancel

1.0  Introduction

This document describes possible document exchange choreographies that could be implemented between trading partners in an Order Management business process.  The business documents used in these choreographies are assumed to be from the xCBL library but any other any standard that supports equivalent documents or messages could also be used.

The choreographies for OrderManagement are divided into four sections:

1.	Order and Order Response Support
2.	Order and Cancel Order Support
3.	Order and Change Order Support
4.	Order with both Change and Cancel Order Support.

These are the general groupings of activities within a choreography that different trading partners may support.  The more sophisticated the trading partner, the more likely that they can support the more complex choreographies.  All of these choreography capabilities build on each other with greater and greater complexity. 

The choreographies are presented with a name, in the form of a URI, a list of the documents/messages used in the choreographies, an indication if the document is considered mandatory for the choreography, and a description of the document exchange. The documents or messages referenced here are:

Order	A message that initiates a purchase order. For xCBL this would be the Order document (PurchaseOrder if xCBL 2.x).
OrderResponse	A message that is a response to a purchase order or change order.  For xCBL this would be the OrderResponse document.
OrderCancel	A message that cancels a purchase order.  For xCBL this could be either an Order or a ChangeOrder document.
ChangeOrder	A message that contains changes to an original purchase order or to a previous change order document.
. 
2.0   Order and Order Response Support
This is the simplest grouping of activities between trading partners for the exchange or Order related messages.

2.1 Order Only
Name:  x-ccns:choreography::OrderManagementChoreography1v1.0
Messages Implemented:	Order (Mandatory)
Description:	This choreography allows for a buyer to send an Order message to the supplier with no OrderResponse message returned by the supplier to the buyer.

2.2 Order with OrderResponse
Name:	x-ccns:choreography::OrderManagementChoreography2v1.0
Messages Implemented:	Order (Mandatory)
				OrderResponse (Mandatory)
Description:	This choreography allows for a buyer to send an Order message to the supplier and the supplier returns one and only one OrderResponse message.

2.3 Order with Multiple OrderResponses
Name: x-ccns:choreography::OrderManagementChoreography3v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (1 response is mandatory, additional are optional)
Description:	This choreography allows for a buyer to send an Order message to the supplier and the supplier returns at least one OrderResponse message.  The supplier can send additional  OrderResponse messages if needed to update information regarding the order.

3.0   Order and Cancel Order Support
This set of choreographies builds upon the Order and OrderResponse related choreographies.  This takes those baseline choreographies and adds in the support for cancellation of an Order.  Once an Order has been sent to the supplier, the Order can be cancelled at any point that the Order is still active.   Trading partners may have different agreements on what is considered an active order (order has been shipped, order is invoiced, etc..)  In xCBL, the cancellation of a purchase order can be done with either the Order or ChangeOrder documents.  The Order would be used prior to the receipt of an OrderResponse.  The ChangeOrder would be used when an OrderResponse has been received.

3.1 Order with Cancel
Name:	x-ccns:choreography::OrderManagementChoreography4v1.0
Messages Implemented:	Order (Mandatory)
				CancelOrder (Optional)
	CancelOrderResponse (Mandatory if the CancelOrder is sent)
Description:	This choreography allows for a buyer to send an Order message to the supplier and then Cancel the Order without receiving an OrderResponse to the Original Order.  The supplier must provide a response to the CancelOrder message.  In this case the supplier or buyer does not provide support for an OrderResponse to the original Order.

3.2 Order with OrderResponse and Cancel
Name:	x-ccns:choreography::OrderManagementChoreography5v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory – unless a CancelOrder is sent prior and cancellation is accepted)
CancelOrder (Optional)
CancelOrderResponse (Mandatory – if the CancelOrder is sent)

Description:	This choreography allows for a buyer to send an Order message to the supplier and then Cancel the Order either before or after receiving an OrderResponse to the Original Order. Once the CancelOrder is sent, the supplier should not respond with an OrderResponse message, and only provide a CancelOrderResponse message.  They must provide a response to the CancelOrder message.  If the supplier rejects the cancellation of the order, they may then provide an OrderResponse message to the original Order.

3.3 Order with Multiple OrderResponses and Cancel
Name:	x-ccns:choreography::OrderManagementChoreography6v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory – unless a CancelOrder is sent prior and cancellation is accepted, additionally more than one OrderResponse message my be sent)
CancelOrder (Optional)
CancelOrderResponse (Mandatory – if the CancelOrder is sent)
Description:	This choreography allows for a buyer to send an Order message to the supplier and then Cancel the Order either before or after receiving one or more OrderResponses to the Original Order.  Once the CancelOrder is sent, the supplier should not respond with any OrderResponse, and only provide CancelOrderResponses.  They must provide a response to the CancelOrder message.  If the supplier rejects the cancellation of the order, they may then provide an OrderResponse message to the original Order.

4.0 Order and Change Order Support
This set of choreographies builds upon the Order and OrderResponse related choreographies.  This takes those baseline choreographies and adds in the support for changing of an Order.  Once an Order has been sent to the supplier and the supplier has provided an OrderResponse, the buyer can then change the order.  In some cases, there may be support for just one ChangeOrder per original Order, or there may be support for multiple ChangeOrder(s). 

4.1 Order with OrderResponse and ChangeOrder
Name:	x-ccns:choreography::OrderManagementChoreography7v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory)
ChangeOrder (Optional)
ChangeOrderResponse (Mandatory – if the ChangeOrder is sent)
Description:	This choreography allows for a buyer to send an Order message to the supplier and receive one and only one OrderResponse.  Once the OrderResponse has been received, the buyer is optionally able to send one and only one ChangeOrder.  For the one ChangeOrder sent to the supplier, the supplier will provide one ChangeOrderResponse.

4.2 Order with Multiple OrderResponses and ChangeOrder
Name:	x-ccns:choreography::OrderManagementChoreography8v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory – additional response can be processed as well)
ChangeOrder (Optional)
ChangeOrderResponse (Mandatory – if the ChangeOrder is sent)
Description:	This choreography allows for a buyer to send an Order message to the supplier and receive one or more OrderResponses.  Once an OrderResponse has been received, the buyer is optionally able to send one and only one ChangeOrder.  For the one ChangeOrder sent to the supplier, the supplier will provide one and only one ChangeOrderResponse.  Once the ChangeOrder has been sent, the buyer is not able to receive OrderResponse messages for the original Order.

4.3 Order with OrderResponse and Multiple ChangeOrders
Name:	x-ccns:choreography::OrderManagementChoreography9v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory)
ChangeOrder (Optional – more than one ChangeOrder per Order is allowed)
ChangeOrderResponse (Mandatory – if ChangeOrder is sent)

Description:	This choreography allows for a buyer to send an Order message to the supplier and receive one and only one OrderResponse.  Once the OrderResponse has been received, the buyer is optionally able to send one or more ChangeOrder messages.  For each ChangeOrder message sent to the supplier, the supplier will provide one ChangeOrderResponse message.  Once the ChangeOrder message has been sent, the buyer is not able to receive OrderResponse messages for the original Order.

4.4 Order with Multiple OrderResponse and Multiple ChangeOrder
Name:	x-ccns:choreography::OrderManagementChoreography10v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory – more than OrderResponse may be sent)
ChangeOrder (Optional – more than one ChangeOrder per Order is allowed)
ChangeOrderResponse (Mandatory – if ChangeOrder is sent)
Description:	This choreography allows for a buyer to send an Order message to the supplier and receive one or more OrderResponse messages.  Once an OrderResponse message has been received, the buyer is optionally able to send one or more ChangeOrder messages.  For each ChangeOrder message sent to the supplier, the supplier will provide one ChangeOrderResponse message.  Once the ChangeOrder message has been sent, the buyer is not able to receive OrderResponse messages for the original Order.

5.0 Order with Change Order and Cancel Order Support
This set of choreographies builds upon the Order and OrderResponse related choreographies.  This set of choreographies takes the baseline choreographies and adds in the support for changing of an Order as well as canceling of the Order.  Once an Order has been sent to the supplier it can be cancelled at anytime.  A change to an Order can only be made after the supplier has provided an OrderResponse.  Additional changes, if supported, can only be made if there was a ChangeOrderResponse to the previous ChangeOrder.  Once the buyer has requested a cancellation of an Order, they must receive a CancelOrderResponse before any other documents can be sent to the supplier by the buyer, or for the buyer to accept any other documents from the supplier regarding the Order.  If the supplier rejects the cancellation of the Order, then the buyer can proceed to send either a change if needed, another cancellation, or proceed with the current state of the Order.

5.1 Order with OrderResponse and ChangeOrder and Cancel
Name: x-ccns:choreography::OrderManagementChoreography11v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory.)
CancelOrder (Optional)
CancelOrderResponse (Mandatory if CancelOrder is sent)
ChangeOrder (Ooptional)
ChangeOrderResponse (Mmandatory if ChangeOrder is sent)

Description:	This choreography allows for a buyer to send an Order message to the supplier and requires that they receive one and only one OrderResponse. In addition, this choreography allows for one ChangeOrder per original Order, and also allows for the cancellation of the Order.  This choreography requires for Orders to be sent and responded to, but does not require for Orders to be changed or cancelled, it just allows for them to be supported during runtime.

Once the Order has been sent to the supplier, the buyer can cancel the Order at anytime during the order processing. When the buyer has received the OrderResponse, the buyer is optionally able to end the Order process because they are satisfied with the OrderResponse.  If they are not satisfied with the OrderResponse they can send one and only one ChangeOrder or can decide to cancel the Order.  

For the one ChangeOrder sent to the supplier, the supplier will provide one and only one ChangeOrderResponse.  

If the buyer sent the Order to the supplier and has not received an OrderResponse, and the buyer decides to cancel the Order, they must receive the CancelOrderResponse that will then either end the Order process with an acceptance of the Cancel, or the supplier could reject the cancellation.  If the supplier rejects the cancellation, they can then provide an OrderResponse to the original Order.  Once the OrderResponse has been received the buyer can then either end the Order process, or decide to change or cancel the Order.  

If the Order is changed, the buyer must receive a ChangeOrderResponse message back from the supplier.  If the buyer decides to cancel the order after the ChangeOrder has been sent, but prior to receiving the ChangeOrderResponse, they must receive the CancelOrderResponse.  If the supplier accepts the CancelOrder, then the Order process ends, if the supplier rejects the CancelOrder, then the buyer can accept the ChangeOrderResponse from the supplier.

5.2 Order with OrderResponse and Multiple ChangeOrder and Cancel
Name:	x-ccns:choreography::OrderManagementChoreography12v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory)
CancelOrder (Optional)
CancelOrderResponse (Mandatory if CancelOrder is sent)
ChangeOrder (Optional more than one allowed)
ChangeOrderResponse (Mandatory if ChangeOrder is sent)

Description:	This choreography allows for a buyer to send an Order message to the supplier and requires that they receive one and only one OrderResponse.  This choreography additionally allows for one or more ChangeOrder per original Order, and also allows for the cancellation of the Order.  This choreography requires for Orders to be sent and responded to, but does not require for Orders to be changed or cancelled, it just allows for them to be supported during runtime.

Once the Order has been sent to the supplier, the buyer can cancel the Order at anytime later during this order processing. When the buyer has received the OrderResponse, the buyer is optionally able to end the Order process because they are satisfied with the OrderResponse, they can send one and only one ChangeOrder or can decide to cancel the Order.  

For the one or more ChangeOrder messages sent to the supplier, the supplier will provide one and only one ChangeOrderResponse per ChangeOrder message.  

If the buyer decides to cancel the Order, they will send a CancelOrder message to the supplier.  Once the supplier has received the CancelOrder message, they will provide a CancelOrderResponse.  If the supplier accepts the CancelOrder then this ends the Order process.  If the supplier rejects the CancelOrder, then the Order process returns to the state prior to sending the cancellation.   If the supplier rejects the cancellation, they can then provide an OrderResponse to the original Order.  Once the OrderResponse has been received the buyer can then either end the Order process, or decide to change or cancel the Order.  

If the Order is changed, the buyer must receive a ChangeOrderResponse message back from the supplier.  If the buyer decides to cancel the order prior to receiving the ChangeOrderResponse, they must receive the CancelOrderResponse.  If the supplier accepts the CancelOrder, then the Order process ends, if the supplier rejects the CancelOrder, then the buyer can accept the ChangeOrderResponse from the supplier.  

Once the buyer has received the ChangeOrderResponse, they can end the Order process, make another change to the Order or Cancel the Order.  This cycle can continue until the buyer either accepts the outcome of the change or cancels the Order and the supplier accepts the cancellation.

5.3 Order with Multiple OrderResponse and ChangeOrder and Cancel
Name:	x-ccns:choreography::OrderManagementChoreography13v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory, unless CancelOrder is sent prior to receipt and cancellation is accepted)(More than one accepted as well)
CancelOrder (Optional)
CancelOrderResponse (Mandatory if CancelOrder message is sent)
ChangeOrder (Optional)
ChangeOrderResponse (Mandatory if if ChangeOrder is sent, and order is not cancelled)

Description:	This choreography allows for a buyer to send an Order message to the supplier and requires them to receive at least one or more OrderResponse messages. In addition this choreography allows for one ChangeOrder per original Order, and also allows for the cancellation of the Order.  This choreography requires for Orders to be sent and responded to, but does not require for Orders to be changed or cancelled, it just allows for them to be supported during runtime.

Once the Order has been sent to the supplier, the buyer can cancel the Order at anytime later during this order processing. When the buyer has received the OrderResponse, the buyer is optionally able to end the Order process because they are satisfied with the OrderResponse, they can send one and only one ChangeOrder or can decide to cancel the Order.  The supplier can send additional OrderResponse messages to the buyer unless, a ChangeOrder has been placed, or a CancelOrder message has been sent to the supplier.  

If the supplier rejects the CancelOrder message, they can then send additional OrderResponse messages to the original Order.  If the buyer sent a ChangeOrder and received the ChangeOrderResponse, they could then no longer accept additional OrderResponse messages for the original Order since the state is now related to the changed order.

For the one ChangeOrder sent to the supplier, the supplier will provide one and only one ChangeOrderResponse.  

If the buyer decides to cancel the Order, they will send a CancelOrder message to the supplier.  Once the supplier has received the CancelOrder message, they will provide a CancelOrderResponse.  If the supplier accepts the CancelOrder then this ends the Order process.  If the supplier rejects the CancelOrder, then the Order process returns to the state prior to sending the cancellation.   If the supplier rejects the cancellation, they can then provide an OrderResponse to the original Order.  Once the OrderResponse has been received the buyer can then either end the Order process, or decide to change or cancel the Order.  

If the Order is changed, the buyer must receive a ChangeOrderResponse message back from the supplier.  If the buyer decides to cancel the order prior to receiving the ChangeOrderResponse, they must receive the CancelOrderResponse.  If the supplier accepts the CancelOrder, then the Order process ends, if the supplier rejects the CancelOrder, then the buyer can accept the ChangeOrderResponse from the supplier.
 
5.4 Order with Multiple OrderResponse and Multiple ChangeOrder and Cancel
Name:	x-ccns:choreography::OrderManagementChoreography14v1.0
Messages Implemented:	Order (Mandatory)
OrderResponse (Mandatory, unless CancelOrder is sent prior to receipt and cancellation is accepted) (More than one accepted as well)
CancelOrde (Optional;)
CancelOrderResponse (Mandatory if CancelOrder message is sent)
ChangeOrder (Optional more than one is allowed)
ChangeOrderResponse (Mandatory if if ChangeOrder is sent, and order is not cancelled)  
Description:	This choreography allows for a buyer to send an Order message to the supplier and requires for them to receive one or more OrderResponse messages.  In addition, this choreography allows for one or more ChangeOrder messages per original Order, and also allows for the cancellation of the Order.  This choreography requires for Orders to be sent and responded to, but does not require for Orders to be changed or cancelled, it just allows for them to be supported during runtime.

Once the Order has been sent to the supplier, the buyer can cancel the Order at anytime later during this order processing. When the buyer has received the OrderResponse, the buyer is optionally able to end the Order process because they are satisfied with the OrderResponse and the supplier will not send any additional OrderResponse messages.  If the buyer is not satisfied with the OrderResponse message they can send a ChangeOrder message or can decide to cancel the Order.  The supplier can send additional OrderResponse messages to the buyer unless, a ChangeOrder has been placed, or a CancelOrder message has been sent to the supplier.  If the supplier rejects the CancelOrder message, they can then send additional OrderResponse messages to the original Order.  If the buyer sent a ChangeOrder and received the ChangeOrderResponse, they can no longer accept additional OrderResponse messages for the original Order.

For the one ChangeOrder sent to the supplier, the supplier will provide one and only one ChangeOrderResponse.  

If the buyer decides to cancel the Order, they will send a CancelOrder message to the supplier.  Once the supplier has received the CancelOrder message, they will provide a CancelOrderResponse.  If the supplier accepts the CancelOrder then this ends the Order process.  If the supplier rejects the CancelOrder, then the Order process returns to the state prior to sending the cancellation.  If the supplier rejects the cancellation, they can then provide an OrderResponse to the original Order.  Once the OrderResponse has been received the buyer can then either end the Order process, or decide to change or cancel the Order.  

If the Order is changed, the buyer must receive a ChangeOrderResponse message back from the supplier.  If the buyer decides to cancel the order prior to receiving the ChangeOrderResponse, they must receive the CancelOrderResponse.  If the supplier accepts the CancelOrder, then the Order process ends, if the supplier rejects the CancelOrder, then the buyer can accept the ChangeOrderResponse from the supplier.

Once the buyer has received the ChangeOrderResponse, they can end the Order process, make another change to the Order or Cancel the Order.  This cycle can continue until the buyer either accepts the outcome of the change or cancels the Order and the supplier accepts the cancellation.