private ConfigurationDocument createConfigFile(StringToStringMap values) {
    ConfigurationDocument configDocument = ConfigurationDocument.Factory.newInstance();
    ConfigurationType config = configDocument.addNewConfiguration();

    JavaToWsdlType java2Wsdl = config.addNewJavaWsdl();
    ServiceType service = java2Wsdl.addNewService();
    service.setEndpoint(values.get(ENDPOINT));
    service.setStyle(Style.Enum.forString(values.get(STYLE)));
    service.setParameterStyle(ParameterStyle.Enum.forString(values.get(PARAMETER_STYLE)));
    service.setName(values.get(SERVICE_NAME));

    MappingType mapping = java2Wsdl.addNewMapping();
    mapping.setFile(values.get(MAPPING));

    NamespacesType namespaces = java2Wsdl.addNewNamespaces();
    namespaces.setTargetNamespace(values.get(TARGET_NAMESPACE));
    namespaces.setTypeNamespace(values.get(TYPES_NAMESPACE));

    WsxmlType webservices = java2Wsdl.addNewWebservices();
    if (values.get(EJB_LINK) != null && values.get(EJB_LINK).length() > 0)
      webservices.setEjbLink(values.get(EJB_LINK));
    if (values.get(SERVLET_LINK) != null && values.get(SERVLET_LINK).length() > 0)
      webservices.setServletLink(values.get(SERVLET_LINK));
    return configDocument;
  }
  private String buildConfigFile(StringToStringMap values, Interface modelItem) throws IOException {
    File file = File.createTempFile("wstools-config", ".xml");
    ConfigurationDocument configDocument = createConfigFile(values, modelItem);

    configDocument.save(file);

    return file.getAbsolutePath();
  }
  private ConfigurationDocument createConfigFile(StringToStringMap values, Interface modelItem) {
    ConfigurationDocument configDocument = ConfigurationDocument.Factory.newInstance();
    ConfigurationType config = configDocument.addNewConfiguration();

    try {
      StringToStringMap nsMappings = StringToStringMap.fromXml(values.get(NAMESPACE_MAPPING));
      if (!nsMappings.isEmpty()) {
        GlobalType global = config.addNewGlobal();

        for (String namespace : nsMappings.keySet()) {
          PkgNSType entry = global.addNewPackageNamespace();
          entry.setNamespace(namespace);
          entry.setPackage(nsMappings.get(namespace));
        }
      }
    } catch (Exception e) {
      SoapUI.logError(e);
    }

    WsdlToJavaType wsdl2Java = config.addNewWsdlJava();

    String wsdlUrl = getWsdlUrl(values, modelItem);
    try {
      new URL(wsdlUrl);
      wsdl2Java.setLocation(wsdlUrl);
    } catch (MalformedURLException e) {
      ((Element) wsdl2Java.getDomNode()).setAttribute("file", wsdlUrl);
    }

    if (values.getBoolean(UNWRAP)) wsdl2Java.setParameterStyle(ParameterStyle.BARE);
    else wsdl2Java.setParameterStyle(ParameterStyle.WRAPPED);

    if (values.get(EJB_LINK) != null && values.get(EJB_LINK).length() > 0) {
      WsxmlType webservices = wsdl2Java.addNewWebservices();
      webservices.setEjbLink(values.get(EJB_LINK));
      webservices.setAppend(values.getBoolean(APPEND));
    } else if (values.get(SERVLET_LINK) != null && values.get(SERVLET_LINK).length() > 0) {
      WsxmlType webservices = wsdl2Java.addNewWebservices();
      webservices.setServletLink(values.get(SERVLET_LINK));
      webservices.setAppend(values.getBoolean(APPEND));
    }

    String mappingFile = values.get(MAPPING).toString().trim();
    if (mappingFile.length() > 0) {
      wsdl2Java.addNewMapping().setFile(mappingFile);
    }
    return configDocument;
  }
 protected String getConfigFile() {
   ConfigurationDocument configDocument = createConfigFile(getDialog().getValues(), modelItem);
   return configDocument.toString();
 }