【发布时间】: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