/**
 * Get Attributes Action Sample
 * Returns all of the attributes associated with the item. Optionally, the attributes returned can be limited to
 * the specified AttributeName parameter.
 * If the item does not exist on the replica that was accessed for this operation, an empty attribute is
 * returned. The system does not return an error as it cannot guarantee the item does not exist on other
 * replicas.  
 * @param Amazon_SimpleDB_Interface $service instance of Amazon_SimpleDB_Interface
 * @param mixed $request Amazon_SimpleDB_Model_GetAttributes or array of parameters
 */
function invokeGetAttributes(Amazon_SimpleDB_Interface $service, $request)
{
    try {
        $response = $service->getAttributes($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        GetAttributesResponse\n";
        if ($response->isSetGetAttributesResult()) {
            echo "            GetAttributesResult\n";
            $getAttributesResult = $response->getGetAttributesResult();
            $attributeList = $getAttributesResult->getAttribute();
            foreach ($attributeList as $attribute) {
                echo "                Attribute\n";
                if ($attribute->isSetName()) {
                    echo "                    Name\n";
                    echo "                        " . $attribute->getName() . "\n";
                }
                if ($attribute->isSetValue()) {
                    echo "                    Value\n";
                    echo "                        " . $attribute->getValue() . "\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";
    }
}