/**
  * Generate the ExceptionReport as an XML string.
  *
  * @return the ExceptionReport as an XML string
  */
 public String getXMLExceptionReport() {
   Map<String, String> suggestedPrefixes = new HashMap<String, String>();
   suggestedPrefixes.put("http://www.opengis.net/ows/2.0", "ows");
   XmlOptions opts = new XmlOptions();
   opts.setSavePrettyPrint();
   opts.setSaveSuggestedPrefixes(suggestedPrefixes);
   opts.setSaveNamespacesFirst();
   opts.setSaveAggressiveNamespaces();
   opts.setUseDefaultNamespace();
   return exceptionReportDoc.xmlText(opts);
 }
  /**
   * Creates a WPS ExceptionReport, specifying the version and the language.
   *
   * @param version the ExceptionReport version
   * @param language the ExceptionReport language
   */
  public ExceptionHandler(String version, String language) {
    exceptionReportDoc = ExceptionReportDocument.Factory.newInstance();
    exceptionReport = exceptionReportDoc.addNewExceptionReport();

    exceptionReport.setVersion(version);

    // lang attribute is optional
    if (language != null) {
      exceptionReport.setLang(language);
    }
  }