Exemplo n.º 1
0
 public static String serviceConfigToXml(final ServiceConfig serviceConfig)
     throws CodeGenFailedException {
   final StringWriter writer = new StringWriter();
   try {
     final JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance();
     javaXmlBinder.generateServiceConfigXml(serviceConfig, writer);
   } catch (final Exception ex) {
     throw new CodeGenFailedException("Failed to generate Service Config xml file", ex);
   }
   return writer.toString();
 }
Exemplo n.º 2
0
  public static void generateServiceConfigXml(
      ServiceConfig serviceConfig, String destLoc, String configFileName)
      throws CodeGenFailedException {

    Writer fileWriter = null;
    try {
      fileWriter = CodeGenUtil.getFileWriter(destLoc, configFileName);

      JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance();
      javaXmlBinder.generateServiceConfigXml(serviceConfig, fileWriter);

    } catch (Exception ex) {
      throw new CodeGenFailedException("Failed to generate Service Config xml file", ex);
    } finally {
      CodeGenUtil.closeQuietly(fileWriter);
    }
  }