throw new ProtocolException("itemList cannot be null");
}
try {
// Create the <items> tag and add each item in the list to the cart
ShoppingCart cart = _objectFact.createShoppingCart();
ItemsType items = _objectFact.createShoppingCartItemsType();
List item_list = items.getItem();
for (int i = 0; i < itemList.size(); i++) {
item_list.add(itemList.get(i));
}
cart.setItems(items);
// Add the expiration date if one is provided
if (cartExpire != null) {
GregorianCalendar gCal = new GregorianCalendar();
gCal.setTime(cartExpire);
CartExpiration cartExpiry = _objectFact.createCartExpiration();
cartExpiry.setGoodUntilDate(gCal);
cart.setCartExpiration(cartExpiry);
}
// Add merchantPrivateData if it is provided
if (merchantPrivateData != null) {
AnyType anyType = _objectFact.createAnyType();
anyType.setAny(merchantPrivateData);
cart.setMerchantPrivateData(anyType);
}
return cart;
} catch (JAXBException jaxbEx) {
throw new ProtocolException(jaxbEx.getMessage());