6.0.0.2 Add order items to shopping cart
This service request adds order items to the shopping cart. Before using this request, the client must have a reference to the order facade client.
Usage scenario
- The client calls the order facade client method addOrderItem() with the following parameters: (orderId ,quantity,catEntryId,contractID,UOM)
- The OrderFacadeClient composes an SDO then calls the ChangeOrder service using the action code Create and XPath query /Order/OrderItem.
- An order item is created on the WebSphere Commerce Server.
- The Order component responds with a RespondOrder BOD with an orderId and orderItemId that indicates that the order items were successfully updated.
Request
- ChangeOrder BOD
Action code Create XPath /Order/OrderItem Schema Order-DataObjects/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/ChangeOrder.xsd Service data object com.ibm.commerce.order.facade.datatypes.ChangeOrderType
Sample request BOD
<oa:ApplicationArea xsi:type="_wcf:ApplicationAreaType"> <oa:CreationDateTime>2007-01-26T17:55:25.500Z</oa:CreationDateTime> <oa:BODID>57dbba00-ad23-11db-832d-831645b86890</oa:BODID> </oa:ApplicationArea> <_ord:DataArea> <oa:Change> <oa:ActionCriteria> <oa:ActionExpression actionCode="Create" expressionLanguage="wc:XPath"> /Order/OrderItem </oa:ActionExpression> </oa:ActionCriteria> </oa:Change> <_ord:Order> <_ord:OrderIdentifier> <_wcf:UniqueID>.</_wcf:UniqueID> </_ord:OrderIdentifier> <_ord:OrderItem> <_ord:CatalogEntryIdentifier> <_wcf:UniqueID>10002</_wcf:UniqueID> </_ord:CatalogEntryIdentifier> <_ord:Quantity uom="C62">3.0</_ord:Quantity> <_ord:ContractIdentifier> <_wcf:UniqueID>10001</_wcf:UniqueID> </_ord:ContractIdentifier> </_ord:OrderItem> <_ord:OrderItem> <_ord:CatalogEntryIdentifier> <_wcf:UniqueID>10003</_wcf:UniqueID> </_ord:CatalogEntryIdentifier> <_ord:Quantity uom="C62">4.0</_ord:Quantity> <_ord:ContractIdentifier> <_wcf:UniqueID>10001</_wcf:UniqueID> </_ord:ContractIdentifier> </_ord:OrderItem> </_ord:Order> </_ord:DataArea>
Response
The response is the RespondOrder BOD with order ID and order Item ID; the order item has been added to the order.
Schema DataObjects/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/RespondOrder.xsd Service data object
com.ibm.commerce.order.facade.datatypes.RespondOrderTypeThe response contains the following information:/Order/OrderIdentifier/UniqueID/Order/OrderItem/OrderItemIdentifier/UniqueID
Sample response BOD
<ord:RespondOrder xmlns:_ord="http://www.ibm.com/xmlns/prod/commerce/9/order" xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation"> <_ord:DataArea> <_ord:Order> <_ord:OrderIdentifier> <_wcf:UniqueID>43137</_wcf:UniqueID> </_ord:OrderIdentifier> <_ord:OrderItem> <_ord:OrderItemIdentifier> <_wcf:UniqueID>540324</_wcf:UniqueID> </_ord:OrderItemIdentifier> </_ord:OrderItem> <_ord:OrderItem> <_ord:OrderItemIdentifier> <_wcf:UniqueID>540323</_wcf:UniqueID> </_ord:OrderItemIdentifier> </_ord:OrderItem> </_ord:Order> </_ord:DataArea> </_ord:RespondOrder>
Exceptions
See the exception conditions for the
OrderItemAdd URL.
Customization
The following extensions are supported:
- Extend the methods buildOrderItem and buildOrderIdentifier of
OrderFacadeClient to handle the input parameters.- Extend the command RespondOrderBuildCmdImpl to populate information into the response.
- Customize the messaging mapping file ChangeOrderSOIBODMapping.xml. Find the section:
<Command CommandName="com.ibm.commerce.orderitems.commands.OrderItemAddCmd" Condition='actionCode="Create" AND actionExpression="/Order/OrderItem"'>Replace the RespondOrderBuildCmdImpl with the new command that extends RespondOrderBuildCmdImpl.
Related reference
WebSphere Commerce services
Order services