Beispiel #1
0
  // Used to save values from table GUI components
  protected List<StringToStringMap> readTableValues(
      XmlObjectConfigurationReader reader, String parameterName) {
    List<StringToStringMap> result = new ArrayList<StringToStringMap>();
    String[] tableValues = reader.readStrings(parameterName);
    if (tableValues != null && tableValues.length > 0) {
      for (String tableValue : tableValues) {
        result.add(StringToStringMap.fromXml(tableValue));
      }
    }

    return result;
  }
  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;
  }
Beispiel #3
0
  protected StringToStringMap initValues(T modelItem, Object param) {
    String settingValues =
        modelItem == null
            ? SoapUI.getSettings().getString(valuesSettingID, null)
            : modelItem.getSettings().getString(valuesSettingID, null);

    StringToStringMap result =
        settingValues == null ? new StringToStringMap() : StringToStringMap.fromXml(settingValues);

    if (modelItem instanceof WsdlInterface) {
      initWSDL(result, (WsdlInterface) modelItem);
    }

    if (dialog != null && modelItem != null) {
      String projectRoot = modelItem.getSettings().getString(ProjectSettings.PROJECT_ROOT, null);
      if (projectRoot != null)
        dialog.setFormFieldProperty(ProjectSettings.PROJECT_ROOT, projectRoot);
    }

    return result;
  }