webMethods DSP

Hello,

I am trying to invoke a WebMethods flow service from Java Script using DSP code.

I am getting the return value as “undefined”. What am I missing? Please help.

Below is my Javascript code

function GenerateTable() {
//Build an array containing Customer records.
var directories = new Array();
directories.push([“File Directory”,“Date”,“File Count”]);

var dirName = document.getElementById("directory"); 



for (i=1;i<dirName.options.length;i++)
{
    if (dirName.options[i].selected == true)
    {  
        directories.push([dirName.options[i].value,document.getElementById("filter").value,%invoke Karthik:listFilesInInputDirectory%  %value numFiles%  %endinvoke%]); 			 
    }
}


//Create a HTML Table element.
var table = document.createElement("TABLE");
table.border = "1";

//Get the count of columns.
var columnCount = directories[0].length;

//Add the header row.
var row = table.insertRow(-1);
for (var i = 0; i < columnCount; i++) {
    var headerCell = document.createElement("TH");
    headerCell.innerHTML = directories[0][i];
    row.appendChild(headerCell);
}

//Add the data rows.
for (var i = 1; i < directories.length; i++) {
    row = table.insertRow(-1);
    for (var j = 0; j < columnCount; j++) {
        var cell = row.insertCell(-1);
        cell.innerHTML = directories[i][j];
    }
}

var dvTable = document.getElementById("dvTable");
dvTable.innerHTML = "";
dvTable.appendChild(table);

}

Thanks in advance
Karthik