Docusign通过ProcessBuilder检索

本文关键字:检索 ProcessBuilder 通过 Docusign | 更新日期: 2023-09-27 18:29:58

我正试图构建一个java进程,通过命令行执行docusign检索产品。我已经编写了基于给定属性文件执行的流程。

        buildRoot = isWindowsOs() ? "C:" + "''Program Files (x86)''DocuSign, Inc''Retrieve 3.2" : "''Program Files (x86)''DocuSign, Inc''Retrieve 3.2" ;
        String[] command = new String [2];
        command[0] = "'""+buildRoot+ "''" + docuSignAppName+"'"";
        logger.info(command[0].toString());
        //ADDED FOR EXPLANATION - "C:'Program Files (x86)'DocuSign, Inc'Retrieve 3.2'DocuSignRetrieve.exe"
        command[1] = arguments;
        logger.info(command[1].toString());
        ProcessBuilder processBuilder = new ProcessBuilder(command);
        logger.info("ProcessBuilder starting directory" +processBuilder.directory());
        processBuilder.redirectErrorStream(true);
        p = processBuilder.start();
        InputStream is = p.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        stdout = new BufferedReader(isr);

一旦我传入构建的参数字符串,执行的代码看起来就像提供的示例,但总是会导致错误返回到屏幕"缺少"accountid"parameter"。

参数列表如下所示
/端点"Demo"/userid"已删除"/密码"已删除"/accountid"已删除"/span"-1"/spanfilter"Completed"(已完成)/statusfilter"已完成"/fieldlog"字段列表"/nstyle"信封ID"/保存"MergedPdfWithoutCert"/dir"D:''DocuSignStore"/包括"真正的"

如有任何帮助或协助,我们将不胜感激。

Docusign通过ProcessBuilder检索

该解决方案是在关于ProcessBuilder常见问题的StackOverflow讨论中找到的。

我的问题是,我希望通过更改完整路径中的输入,我可以运行可执行文件。由于我现在不确定的原因,这并没有像预期的那样奏效。解决方案是运行CMD命令,该命令存在于任何windows操作系统的%PATH%上。

    String[] command = new String [2];
    command[0] = "'""+buildRoot+ "''" + docuSignAppName+"'"";
    logger.info(command[0].toString());
    //ADDED FOR EXPLANATION - "C:'Program Files (x86)'DocuSign, Inc'Retrieve 3.2'DocuSignRetrieve.exe"
    command[1] = arguments;
    logger.info(command[1].toString());
    //This starts a new command prompt
    ProcessBuilder processBuilder = new ProcessBuilder("cmd","/c","DocusignRetreive.exe);
    //This sets the directory to run the command prompt from
    File newLoc = new File("C:/Program Files (x86)/DocuSign, Inc/Retrieve 3.2");
    processBuilder.directory(newLoc);
    logger.info("ProcessBuilder starting directory" +processBuilder.directory());
    processBuilder.redirectErrorStream(true);
    /*When the process builder starts the prompt looks like
     *C:'Program Files (x86)'DocuSign, Inc'Retrieve 3.2
     *Now DocusignRetrieve.exe is an executable in the directory to be run
     */
    p = processBuilder.start();