Index: /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
===================================================================
--- /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java	(revision 21572)
+++ /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java	(revision 21573)
@@ -186,5 +186,5 @@
 	 * - name of the index into which the GS3 documents have been indexed 
 	 * and which FedoraGenericSearch should use to perform searches. If none is
-	 * given in the properties file, then the index name defaults "FedoraIndex".
+	 * given in the properties file, then the index name defaults to "FedoraIndex".
 	 * @param properties is the Properties Map loaded from a properties file
 	 * (if there was any) which specifies such things as host and port of the
@@ -469,5 +469,5 @@
 			String docPID = getDocPIDFromDocID(id);
 			if(sectionID.equals("") || sectionID.equals("1")) { 
-				//metadata of toplevel document is requested
+				// metadata of toplevel document is requested
 				ex = this.getEX(docPID); // slightly faster than doing
 						//getSectionEXMetadata(docID, "1")
@@ -662,4 +662,5 @@
 		}catch(Exception e) { 
 			ex = new FedoraGS3RunException(e);
+			//ex.setSpecifics("EX metadata datastream PID: |" + docIDs[i] + "|"); // for debugging PID
 			ex.setSpecifics("EX metadata datastream");
 		}
Index: /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java
===================================================================
--- /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java	(revision 21572)
+++ /other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java	(revision 21573)
@@ -179,6 +179,6 @@
 	*/
 	protected String gFindObjects(String searchFieldedTerms, String sort, 
-			int hitPageStart, int hitPageSize, int snippetsMax, 
-			int fieldMaxLength, String indexName, String resultPageXslt) throws Exception
+			int hitPageStart, int hitPageSize, int snippetsMax,
+			/*int fieldMaxLength,*/ String indexName, String resultPageXslt) throws Exception
 	{
 		// "Prefills as much info from the WSDL as it can. Right now it's SOAPAction, 
@@ -191,8 +191,24 @@
 		call.setOperationName(G_FIND_OBJECTS);
 		
+		// Max num of chars in field vals returned. Since return values exceeding 
+		// maxlength will be truncated, ensure length suffices for long PIDs returned.
+		// The only element of the response XML we'll be using is the PID of the document
+		// in which the searchTerm occurred.
+		final int fieldMaxLength = 100; // NOT TRUE: max length in words of field values
+		      // returned. E.g. snippet sizes will be reduced to fieldMaxLength words too.
+
+		// This is the method call for Fedora 2's GSearch
+		//String valueFound =(String)call.invoke( new Object[] {
+		//	searchFieldedTerms, sort, hitPageStart, hitPageSize, snippetsMax,
+		//	fieldMaxLength, indexName, resultPageXslt} );
+
+		// The method call for GSearch 2.2 of Fedora 3 takes the args in a different order:
 		String valueFound =(String)call.invoke( new Object[] {
-				searchFieldedTerms, sort, hitPageStart, hitPageSize, snippetsMax,
-				fieldMaxLength, indexName, resultPageXslt} );
-					
+			searchFieldedTerms, hitPageStart, hitPageSize, snippetsMax,
+			fieldMaxLength, indexName, sort, resultPageXslt} );
+		
+		// for debugging
+		//javax.swing.JOptionPane.showMessageDialog(null, "GSearchConnection.gFindObjects:" + valueFound);
+			
 		return valueFound;
 	}
@@ -215,9 +231,4 @@
 	{
 		final String sort = ""; // returns results from highest to lowest rank
-		final int fieldMaxLength = 50; // maximum length in words of field values 
-				// returned. E.g. snippet sizes will be reduced to fieldMaxLength 
-				// words too. It doesn't matter what we set this too, the only
-				// element of the response XML we'll be using is the PID of the
-				// document in which the searchTerm occurred.
 		final String resultPageXslt = "";		
 		
@@ -229,5 +240,5 @@
 		return gFindObjects(fullSearchTerm, sort, 
 			hitPageStart, hitPageSize, snippetsMax, 
-			fieldMaxLength, indexName, resultPageXslt);
+			indexName, resultPageXslt);
 	}
 	
@@ -369,11 +380,8 @@
 		
 		final String sort = ""; // returns results from highest to lowest rank
-		final int fieldMaxLength = 50; // maximum length in words of field values 
-				// returned. E.g. snippet sizes will be reduced to fieldMaxLength 
-				// words too
 		final String resultPageXslt = "";		
 		return gFindObjects(fieldedSearchTerms, sort, 
 				hitPageStart, hitPageSize, snippetsMax, 
-				fieldMaxLength, indexName, resultPageXslt);
+				indexName, resultPageXslt);
 	}
 	
