Esempio n. 1
0
  public void actionPerformed(ActionEvent e) {
    boolean createOptional =
        request
            .getSettings()
            .getBoolean(WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS);
    if (!createOptional) {
      Boolean create =
          UISupport.confirmOrCancel("Create optional elements in schema?", "Create Request");
      if (create == null) return;

      createOptional = create.booleanValue();
    }

    WsdlOperation wsdlOperation = (WsdlOperation) request.getOperation();
    String req = wsdlOperation.createRequest(createOptional);
    if (req == null) {
      UISupport.showErrorMessage("Request creation failed");
      return;
    }

    if (request.getRequestContent() != null && request.getRequestContent().trim().length() > 0) {
      if (UISupport.confirm("Keep existing values", "Recreate Request")) {
        req =
            SoapUtils.transferSoapHeaders(
                request.getRequestContent(), req, wsdlOperation.getInterface().getSoapVersion());

        req = XmlUtils.transferValues(request.getRequestContent(), req);
      }
    }

    request.setRequestContent(req);
  }
  public void perform(WsdlProject project, Object param) {
    String url = UISupport.prompt("Enter WSDL URL", "Add WSDL from URL", "");
    if (url == null) return;

    try {
      Boolean createRequests =
          UISupport.confirmOrCancel("Create default requests for all operations", "Import WSDL");
      if (createRequests == null) return;

      Interface[] ifaces = WsdlInterfaceFactory.importWsdl(project, url, createRequests);
      if (ifaces != null && ifaces.length > 0) UISupport.select(ifaces[0]);
    } catch (Exception ex) {
      UISupport.showErrorMessage(ex.getMessage() + ":" + ex.getCause());
    }
  }
  public boolean importData(JComponent c, Transferable t) {
    Object obj;
    try {
      List<File> files = (List<File>) t.getTransferData(fileFlavor);
      for (File f : files) {
        System.out.println("Got a file: " + f.getName());
        Boolean retval =
            UISupport.confirmOrCancel("Cache attachment in request?", "Att Attachment");
        if (retval == null) return false;

        attachmentModel.addFile(f, retval);
      }

    } catch (IOException ex) {
      ex.printStackTrace();
    } catch (UnsupportedFlavorException ex) {
      ex.printStackTrace();
    }
    return false;
  }