respElement=SoapUtils.getMultiPartTestResponse(srvReq, reqElement);
    private static Element soapRequestDispatcher(HttpServletRequest srvReq, Element reqElement){        Element respElement = null;        try {            List cmds = reqElement.getChildren();            if(cmds.size() == 1){                Element cmd = (Element) cmds.get(0);                if (cmd.getName().equals("GetMultiPartTest")) {                    System.out.println("Received GetMultiPartTest reqElement.");                    respElement=SoapUtils.getMultiPartTestResponse(srvReq, reqElement);                }                else if (cmd.getName().equals("GetDDX")) {                    System.out.println("Received GetDDX reqElement.");                    Element dataSet = cmd.getChild("DataSet");                    String datasetname = dataSet.getChild("name").getTextTrim();                    String ce = dataSet.getChild("ConstraintExpression").getTextTrim();                    System.out.println("Processing DataSet - path: "+datasetname+"   ce: "+ce);                    respElement = new Element("Response");                    respElement.setAttribute("reqID",reqElement.getAttributeValue("reqID"));                    respElement.addContent(BesAPI.getDDXDocument(datasetname, ce).detachRootElement());                }                else if (cmd.getName().equals("GetTHREDDSCatalog")) {                    System.out.println("Received GetTHREDDSCatalog reqElement.");                    String path = cmd.getChild("path").getTextTrim();                    path = BESCrawlableDataset.besPath2ThreddsPath(path);                    BESCrawlableDataset s4cd = new BESCrawlableDataset(path, null);                    if (s4cd.isCollection()) {                        SimpleCatalogBuilder scb = new SimpleCatalogBuilder(                                "",                                   // CollectionID, which for us needs to be empty.                                BESCrawlableDataset.getRootDataset(), // Root dataset of this collection                                "OPeNDAP-Server4",                    // Service Name                                "OPeNDAP",                            // Service Type Name                                srvReq.getRequestURI().substring(0, srvReq.getRequestURI().lastIndexOf(srvReq.getPathInfo()) + 1)); // Base URL for this service                        if (Debug.isSet("showResponse")) {                            System.out.println("SOAPRequestDispatcher:GetTHREDDSCatalog - Generating catalog");                        }                        //System.out.println("\n\nCATALOG:\n"+scb.generateCatalogAsString(s4cd)+"\n");                        Document catalog = scb.generateCatalogAsDocument(s4cd);                        if(catalog == null){                            System.out.println("SimpleCatalogBuilder.generateCatalogAsDocument("+path+") returned null.");                            respElement =  makeExceptionElement(                                    "BadSOAPRequest",                                    "Requested catalog ("+cmd.getChild("path").getTextTrim()+" is not available.",                                    "opendap.coreServlet.SOAPRequestDispatcher.soapDispatcher()"                            );                        }                        else {                            respElement = new Element("Response");                            respElement.setAttribute("reqID",reqElement.getAttributeValue("reqID"));                            respElement.addContent(catalog.detachRootElement());                        }                    } else {                        String msg = "ERROR: THREDDS catalogs may only be requested for collections, " +                                "not for individual data sets. The path: \""+cmd.getChild("path").getTextTrim()+                                "\" does not resolve to a collection.";                        respElement =  makeExceptionElement(                                "BadSOAPRequest",                                msg,                                "opendap.coreServlet.SOAPRequestDispatcher.soapDispatcher()"                        );                    }                }            }            else {                System.out.println("Received Bad SOAP Request. reqID "+reqElement.getAttribute("reqID"));                        respElement =  makeExceptionElement(                                "BadSOAPRequest",                                "Requests must contain one, and only one, command element. Found: " + cmds.size()+" elements.",                                "opendap.coreServlet.SOAPRequestDispatcher.soapDispatcher()"                        );            }        } catch (Exception e) {            respElement = anyExceptionElementBuilder(e);        }        if(respElement == null) {            System.out.println("Received Bad Soap reqElement: "+reqElement.getName());                    respElement =  makeExceptionElement(                            "BadSOAPRequest",                            "Request (reqID: " + reqElement.getAttributeValue("reqID") + ") not recognized by this server.",                            "opendap.coreServlet.SOAPRequestDispatcher.soapDispatcher()"                    );        }        return respElement;    }