0
在一個沒有函數聲明的java服務中,函數調用在那裏,只有編譯時錯誤。但是輸出如預期的那樣沒有運行時錯誤。這怎麼可能?任何人都可以解釋嗎?Java服務錯誤 - webMethods
「方法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設計器。代碼被使用並且只有通過調用該函數,纔會將值分配給輸出變量。它按預期拋出輸出。 – Sowndarya
我粘貼了代碼。請幫助。 – Sowndarya