Index: main/trunk/greenstone3/resources/java/QBRSOAPServer.java.in
===================================================================
--- main/trunk/greenstone3/resources/java/QBRSOAPServer.java.in	(revision 31977)
+++ main/trunk/greenstone3/resources/java/QBRSOAPServer.java.in	(revision 31978)
@@ -86,10 +86,10 @@
 	
 	/** Container Document to create XML Nodes */
-	protected Document doc=null;
+  //	protected Document doc=null;
 	/** A converter class to parse XML and create Docs */
-	protected XMLConverter converter=null;
+  //	protected XMLConverter converter=null;
 
 	/** The Logger for this class */
-	private static Logger LOG = Logger.getLogger(QBRSOAPServer@sitename@.class);
+  private static Logger LOG = Logger.getLogger(org.greenstone.gsdl3.QBRSOAPServer@sitename@.class.getName());
 	
 	/** Error message loading helpFile. Remains at "" if everything is fine */
@@ -161,6 +161,6 @@
 		    return;
 		} 
-		this.converter = new XMLConverter();
-		this.doc = this.converter.newDOM();
+		//this.converter = new XMLConverter();
+		//this.doc = this.converter.newDOM();
 		
 		mr = new MessageRouter();
@@ -262,9 +262,14 @@
 			String subsetOption, String validSubsetOptions)
 	{
+	  Document doc = XMLConverter.newDOM();
 		// Create message element: <message></message>
-		Element message = this.doc.createElement(GSXML.MESSAGE_ELEM);
+		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
 		// <message><request lang="en" to="" type="describe" uid="" /></message>
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+
 		Element request = GSXML.createBasicRequest(
-				this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, new UserContext(lang, ""));
+				doc, GSXML.REQUEST_TYPE_DESCRIBE, to, uc);
 		
 		// Check if only a subset of this Module Interface's data is asked
@@ -279,5 +284,5 @@
 			// else, append <paramList>
 			// <param name="subset" value="subsetOption" /></paramList>
-			Element paramList = this.doc.createElement(
+			Element paramList = doc.createElement(
 					GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 			// append <param name="subset" value=paramValue />
@@ -286,5 +291,5 @@
 			// or GSXML.SYSTEM_SUBSET_ATT. It's the first one probably.
 			paramList.appendChild(GSXML.createParameter(
-							this.doc, GSXML.SUBSET_PARAM, subsetOption));
+							doc, GSXML.SUBSET_PARAM, subsetOption));
 			request.appendChild(paramList);
 		}
@@ -312,7 +317,8 @@
 	public String query(String collection, String service, 
 			String lang, Map nameToValsMap) 
-	{ 	
+	{
+	  Document doc = XMLConverter.newDOM();
 		// <paramList></paramList>
-		Element paramList = this.doc.createElement(
+		Element paramList = doc.createElement(
 				GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 		// <param>s: creating parameters of (name, value) pairs
@@ -324,11 +330,15 @@
 			String value = (String)entry.getValue();
 			paramList.appendChild(GSXML.createParameter(
-					this.doc, name, value));
-		}
-
-		Element message = this.doc.createElement(GSXML.MESSAGE_ELEM);
+					doc, name, value));
+		}
+
+		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+
 		Element request = GSXML.createBasicRequest(
-				this.doc, GSXML.REQUEST_TYPE_PROCESS, 
-				collection+"/"+service, new UserContext(lang, ""));
+				doc, GSXML.REQUEST_TYPE_PROCESS, 
+				collection+"/"+service, uc);
 		
 		request.appendChild(paramList);
@@ -359,5 +369,5 @@
 		//System.out.println(queryDescription);
 		
-		Document doc = this.converter.getDOM(queryDescription);
+		Document doc = XMLConverter.getDOM(queryDescription);
 		NodeList nl = doc.getElementsByTagName(
 				GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
@@ -408,11 +418,12 @@
 			String collection, String lang, String[] docNodeIDs) 
 	{
+	  Document doc = XMLConverter.newDOM();
 		// creating <documentNodeList></documentNodeList>
-		Element docNodeList = this.doc.createElement(
+		Element docNodeList = doc.createElement(
 				GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);
 		
 		// creating subelements: <documentNode nodeID="..." />
 		for(int i = 0; i < docNodeIDs.length; i++) {
-			Element docNode = this.doc.createElement(GSXML.DOC_NODE_ELEM);
+			Element docNode = doc.createElement(GSXML.DOC_NODE_ELEM);
 			docNode.setAttribute(GSXML.NODE_ID_ATT, docNodeIDs[i]);
 			docNodeList.appendChild(docNode);
@@ -420,7 +431,11 @@
 
 		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+
 		Element request = GSXML.createBasicRequest(
 				doc, GSXML.REQUEST_TYPE_PROCESS, 
-				collection+"/DocumentContentRetrieve", new UserContext(lang, ""));
+				collection+"/DocumentContentRetrieve", uc);
 		
 		// create an empty <paramlist /> element (as example in manual)
@@ -470,9 +485,10 @@
 			String[] docNodeIDs, String[] structure, String[] info)
 	{
+	  Document doc = XMLConverter.newDOM();
 		// creating subelements: <documentNode nodeID="..." />
-		Element docNodeList = this.doc.createElement(
+		Element docNodeList = doc.createElement(
 				GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);
 		for(int i = 0; i < docNodeIDs.length; i++) {
-			Element docNode = this.doc.createElement(GSXML.DOC_NODE_ELEM);
+			Element docNode = doc.createElement(GSXML.DOC_NODE_ELEM);
 			docNode.setAttribute(GSXML.NODE_ID_ATT, docNodeIDs[i]);
 			docNodeList.appendChild(docNode);
@@ -480,7 +496,11 @@
 		
 		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+
 		Element request = GSXML.createBasicRequest(
 				doc, GSXML.REQUEST_TYPE_PROCESS, 
-				collection+"/DocumentStructureRetrieve", new UserContext(lang, ""));
+				collection+"/DocumentStructureRetrieve", uc);
 		
 		// Create the <paramlist></paramlist> element of param elements,
@@ -496,5 +516,5 @@
 				if(structureOptions.indexOf(structure[i]) != -1) {
 					paramList.appendChild(GSXML.createParameter(
-							this.doc, "structure", structure[i]));					
+							doc, "structure", structure[i]));					
 				}
 			} 
@@ -504,5 +524,5 @@
 				if(structureInfoOptions.indexOf(info[i]) != -1) {
 					paramList.appendChild(GSXML.createParameter(
-							this.doc, "info", info[i]));
+							doc, "info", info[i]));
 				}
 			}
@@ -612,19 +632,20 @@
 			String[] nodeIDs, String[] metaNames, final String NODE_ELEM)
 	{
+	  Document doc = XMLConverter.newDOM();
 		// create the <paramlist></paramlist> element of param elements:  
 		// <param name="metadata" value = "metaName[i]">
-		Element metadataParamList = this.doc.createElement(
+		Element metadataParamList = doc.createElement(
 				GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 		for(int i = 0; i < metaNames.length; i++) {
 			metadataParamList.appendChild(GSXML.createParameter(
-					this.doc, GSXML.METADATA_ELEM, metaNames[i]));
+					doc, GSXML.METADATA_ELEM, metaNames[i]));
 		}
 		
 		// creating subelements: <documentNode nodeID="..." />
 		// or <classifierNode nodeID="..." />
-		Element nodeList = this.doc.createElement(
+		Element nodeList = doc.createElement(
 				NODE_ELEM+GSXML.LIST_MODIFIER);
 		for(int i = 0; i < nodeIDs.length; i++) {
-			Element docNode = this.doc.createElement(NODE_ELEM);
+			Element docNode = doc.createElement(NODE_ELEM);
 			docNode.setAttribute(GSXML.NODE_ID_ATT, nodeIDs[i]);
 			nodeList.appendChild(docNode);
@@ -632,6 +653,10 @@
 		
 		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+
 		Element request = GSXML.createBasicRequest(doc, 
-				GSXML.REQUEST_TYPE_PROCESS, to, new UserContext(lang, ""));
+				GSXML.REQUEST_TYPE_PROCESS, to, uc);
 		
 		request.appendChild(metadataParamList);
@@ -688,13 +713,18 @@
 		if(browseService.equals(""))
 			browseService = "ClassifierBrowse";
-		
+
+		Document doc = XMLConverter.newDOM();
 		// Create message element: <message></message>
-		Element message = this.doc.createElement(GSXML.MESSAGE_ELEM);
+		Element message = doc.createElement(GSXML.MESSAGE_ELEM);
 		// <message><request lang="en" to="" type="process" uid="" /></message>
-		Element request = GSXML.createBasicRequest(this.doc,
-			GSXML.REQUEST_TYPE_PROCESS, collection+"/"+browseService, new UserContext(lang, ""));
+		UserContext uc = new UserContext();
+		uc.setLanguage(lang);
+                uc.setUserID("");
+		
+		Element request = GSXML.createBasicRequest(doc,
+			GSXML.REQUEST_TYPE_PROCESS, collection+"/"+browseService, uc);
 		
 		// <param name="structure" value = "structureParams[i]">
-		Element paramList = this.doc.createElement(
+		Element paramList = doc.createElement(
 				GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 		for(int i = 0; i < structureParams.length; i++) {
@@ -702,5 +732,5 @@
 			if(structureOptions.indexOf(structureParams[i]) != -1) {
 				paramList.appendChild(GSXML.createParameter(
-						this.doc, "structure", structureParams[i]));
+						doc, "structure", structureParams[i]));
 			}
 		}
@@ -710,5 +740,5 @@
 			if(structureInfoOptions.indexOf(infoParams[i]) != -1) {
 			    paramList.appendChild(GSXML.createParameter(
-						this.doc, "info", infoParams[i]));
+						doc, "info", infoParams[i]));
 			}
 		    }
@@ -718,8 +748,8 @@
 		// 		<classifier nodeID="CLy" /></classifierNodeList> 
 		// where CLx and CLy are given in the parameter classifierNodeIDs
-		Element classifierNodeList = this.doc.createElement(
+		Element classifierNodeList = doc.createElement(
 				GSXML.CLASS_NODE_ELEM+GSXML.LIST_MODIFIER);
 		for(int i = 0; i < classifierNodeIDs.length; i++) {
-			Element classifier = this.doc.createElement(GSXML.CLASS_NODE_ELEM);
+			Element classifier = doc.createElement(GSXML.CLASS_NODE_ELEM);
 			classifier.setAttribute(GSXML.NODE_ID_ATT, classifierNodeIDs[i]);
 			classifierNodeList.appendChild(classifier);
@@ -742,14 +772,14 @@
 	        if(LOG.isDebugEnabled()) { // or LOG.isEnabledFor(Level.DEBUG). 
 		                           // Testing for this improves efficiency
-		    LOG.debug(this.converter.getPrettyString(message));
+		    LOG.debug(XMLConverter.getPrettyString(message));
 		}
 		
 		// Let the messagerouter process the request message and get the response
-		Element response = XMLConverter.nodeToElement(mr.process(message)); 
+		Element response = GSXML.nodeToElement(mr.process(message)); 
 		      // won't be null except when Node returned is not an element
 		      // otherwise, MR always returns some response
 
 		// Return it as a String formatted for display
-		String responseMsg = this.converter.getPrettyString(response); 
+		String responseMsg = XMLConverter.getPrettyString(response); 
 		                  // this.converter.getString(response);
 
