RPC Examples

Contents Hide

  

Example 1. Parsing RPC Parameters

This is the function executed on a remote procedure call to a script server data source.

function executeRPC(functionName, paramNames, paramValues)

{

    if (functionName == "GetAge")

    {

        return getAge(paramValues.get(0)) ;

    }

    ScriptSession.setError(1, "Unknown function") ;

    throw "Unknown function" ;

}

Note:

Example 2. Creating a Sub-function

From the above executeRPC function, subfunctions may be defined and model appropriate functionality

function getAge(name)

{

    // Create result

    result = new ResultRPC() ;

 

    // Pass the parameter back

    result.setOutputParameter("FirstName", name) ;

    result.setOutputParameter("Age", new Integer(44)) ;

 

    return result ;

}

Note: