Index: gsdl/trunk/runtime-src/src/oaiservr/recordaction.cpp
===================================================================
--- gsdl/trunk/runtime-src/src/oaiservr/recordaction.cpp	(revision 16571)
+++ gsdl/trunk/runtime-src/src/oaiservr/recordaction.cpp	(revision 16715)
@@ -30,14 +30,20 @@
 bool recordaction::validateAction(recptproto *protocol, oaiargs &params)
 {
-  int params_size = params.getSize();
-
-  // Remove any parameters that aren't valid for this action
+  // ----------------------------------------------------------------------------
+  //  1. Check for invalid arguments
+  // ----------------------------------------------------------------------------
+  bool invalid_argument_supplied = false;
   text_tmap::const_iterator param_iterator = params.begin();
   while (param_iterator != params.end())
   {
+    // Check for arguments that aren't valid for this action
     if (param_iterator->first != "verb" &&
 	param_iterator->first != "identifier" &&
 	param_iterator->first != "metadataPrefix")
     {
+      // We've found an invalid argument
+      invalid_argument_supplied = true;
+
+      // Delete the invalid argument from the list so it doesn't end up in the <request> tag that is returned
       params.erase(param_iterator->first);
     }
@@ -46,35 +52,60 @@
   }
 
-  text_t meta = params["metadataPrefix"];
-  text_t gsdlId = params["identifier"];
-  text_t gsdlCollect;
-  text_t language = "";
-  int oaiVersion = this->configuration->getOAIVersion();
-
-  // The identifier and metadataPrefix args MUST be supplied, and are the only 
-  // args allowed (excluding verb arg). If we don't have them, throw an error.
-  if(gsdlId == "" || meta == "" || params_size != 3){
+  // If we found an invalid argument it's an error, so don't go any further 
+  if (invalid_argument_supplied)
+  {
     this->errorType = "badArgument";
     return false;
   }
 
-  // Check to see if the metadataPrefix supplied is supported
-  if(this->formatNotSupported(meta)) {
+  // ----------------------------------------------------------------------------
+  //  2. Handle any exclusive arguments
+  // ----------------------------------------------------------------------------
+
+  // None!
+
+  // ----------------------------------------------------------------------------
+  //  3. Handle any required arguments
+  // ----------------------------------------------------------------------------
+
+  // The "metadataPrefix" argument is required
+  text_t metadataPrefix = params["metadataPrefix"];
+
+  // Check that the metadataPrefix argument exists
+  if (metadataPrefix == "")
+  {
+    this->errorType = "badArgument";
+    return false;
+  }
+  // Check that the metadataPrefix is a format we support
+  if (this->formatNotSupported(metadataPrefix))
+  {
     this->errorType = "cannotDisseminateFormat";
-    if(oaiVersion == 200) 
-      return false;
-  }
-
-  // convert record identifier into GSDL format from OAI
-  oaiclassifier::toGSDL(gsdlCollect, gsdlId);
-  
-  // get the document information
-  text_tset        metadata;
-  if (!get_info(gsdlId, gsdlCollect, language, metadata, false, protocol, this->gsdlResponse, *logout)) {
+    return false;
+  }
+
+  // The "identifier" argument is required
+  text_t identifier = params["identifier"];
+
+  // Extract the collection name from the identifier specification
+  text_t collection = "";
+  oaiclassifier::toGSDL(collection, identifier);
+  
+  // Check a document with the specified identifier exists
+  text_tset metadata;
+  if (!get_info(identifier, collection, "", metadata, false, protocol, this->gsdlResponse, *logout))
+  {
     this->errorType = "idDoesNotExist";
-    if(oaiVersion == 200) 
-      return false;
-  }
-
+    return false;
+  }
+
+  // ----------------------------------------------------------------------------
+  // 4. Check any remaining arguments
+  // ----------------------------------------------------------------------------
+
+  // None!
+
+  // If we've reached here everything must be fine
+  this->errorType = "";
   return true;
 }
