/**
 * Batch Put Attributes Action Sample
 * The BatchPutAttributes operation creates or replaces attributes within one or more items.
 * You specify the item name with the Item.X.ItemName parameter.
 * You specify new attributes using a combination of the Item.X.Attribute.Y.Name and Item.X.Attribute.Y.Value parameters.
 * You specify the first attribute for the first item by the parameters Item.0.Attribute.0.Name and Item.0.Attribute.0.Value,
 * the second attribute for the first item by the parameters Item.0.Attribute.1.Name and Item.0.Attribute.1.Value, and so on.
 * Attributes are uniquely identified within an item by their name/value combination. For example, a single
 * item can have the attributes { "first_name", "first_value" } and { "first_name",
 * second_value" }. However, it cannot have two attribute instances where both the Item.X.Attribute.Y.Name and
 * Item.X.Attribute.Y.Value are the same.
 * Optionally, the requestor can supply the Replace parameter for each individual value. Setting this value
 * to true will cause the new attribute value to replace the existing attribute value(s). For example, if an
 * item 'I' has the attributes { 'a', '1' }, { 'b', '2'} and { 'b', '3' } and the requestor does a
 * BacthPutAttributes of {'I', 'b', '4' } with the Replace parameter set to true, the final attributes of the
 * item will be { 'a', '1' } and { 'b', '4' }, replacing the previous values of the 'b' attribute
 * with the new value.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_BatchPutAttributes or array of parameters
 */
function invokeBatchPutAttributes(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->batchPutAttributes($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        BatchPutAttributesResponse\n";
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
            if ($responseMetadata->isSetBoxUsage()) {
                echo "                BoxUsage\n";
                echo "                    " . $responseMetadata->getBoxUsage() . "\n";
            }
        }
    } catch (Amazon_SimpleDB_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}