【问题标题】:Java Service Error - webMethodsJava 服务错误 - webMethods
【发布时间】:2016-03-01 17:50:41
【问题描述】:

在 java 服务中,没有函数声明,函数调用存在,只有编译时错误。但是输出与预期的一样,没有运行时错误。这怎么可能?谁能解释一下?

“方法functionName()未定义”是它显示的错误。

下面是代码。

     public static final void documentToStringVals(IData pipeline)
        throws ServiceException {

    // pipeline
    IDataCursor pipelineCursor = pipeline.getCursor();
    String success = "false";
    IData inputDoc = null;
    String outputValue = "";
    String headerYN = "N"; 
    boolean headerValue = false;
    String delimiter = ","; 
    String newline = System.getProperty("line.separator");

    if (pipelineCursor.first("inputDocument") ) {
        inputDoc = (IData) pipelineCursor.getValue();
    }
    else {
        throw new ServiceException("inputDocument is a required parameter");
    }

    if (pipelineCursor.first("delimiter") ) {
        delimiter = (String) pipelineCursor.getValue();
    }

    if (pipelineCursor.first("headerYN") ) {
        headerYN = (String) pipelineCursor.getValue();
    }
    if (headerYN.equalsIgnoreCase("Y")) {
        headerValue = true;
    }

    try {

        outputValue = docValuesToString(inputDoc, headerValue, delimiter);  

        outputValue += newline;
        success = "true";
    }

    catch (Exception e) {
        System.out.println("Exception in getting string from document: " + e.getMessage());
        pipelineCursor.insertAfter("errorMessage", e.getMessage());
    }
    pipelineCursor.insertAfter("success", success);
    pipelineCursor.insertAfter("outputValue", outputValue);
    pipelineCursor.destroy();
}

【问题讨论】:

  • 您使用的是什么版本的 WebMethods?您使用的是 Designer 还是 Developer?您确定运行时正在使用您的服务中的代码(通过更改某些内容并查看更改是否在运行时发生来确认这一点 - 否则它可能正在执行和旧的 .class 文件)?能发下源代码吗?
  • 我使用的是 9.8 设计器。使用该代码,并且仅通过调用该函数,将值分配给输出变量。它按预期抛出输出。
  • 我已经粘贴了代码。请帮忙。

标签: webmethods


【解决方案1】:

您发布的代码没有引用“functionName”,所以我怀疑在共享代码部分或同一文件夹中的另一个 Java 服务中有对它的引用。鉴于文件夹中的所有 Java 服务都被编译到一个类中,因此所有这些服务都需要一起编译,这可能会导致您在编译上述服务时出现错误消息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-07
    • 2018-08-20
    • 2015-08-30
    • 2017-02-07
    相关资源
    最近更新 更多