/**
 * Put Attributes Action Sample
 * The PutAttributes operation creates or replaces attributes within an item. You specify new attributes
 * using a combination of the Attribute.X.Name and Attribute.X.Value parameters. You specify
 * the first attribute by the parameters Attribute.0.Name and Attribute.0.Value, the second
 * attribute by the parameters Attribute.1.Name and 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 Attribute.X.Name and
 * Attribute.X.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 has the attributes { 'a', '1' }, { 'b', '2'} and { 'b', '3' } and the requestor does a
 * PutAttributes of { '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_PutAttributes or array of parameters
 */
function invokePutAttributes(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->putAttributes($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        PutAttributesResponse\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";
    }
}