system-procs.tcl

Standard reserved methods http://xmlrpc.usefulinc.com/doc/reserved.html

Location:
packages/xml-rpc/tcl/system-procs.tcl
Created:
Thu Oct 9 22:14:04 2003
Author:
Vinod Kurup [vinod@kurup.com]
CVS Identification:
$Id: system-procs.tcl,v 1.7 2024/10/08 15:27:42 antoniop Exp $

Procedures in this file

Detailed information

system.add (public)

 system.add [ args... ]

Simple test function. Add a variable number of integers.

Returns:
integer sum

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

system.listMethods (public)

 system.listMethods

Enumerate the methods implemented by the XML-RPC server. The system.listMethods method requires no parameters.

Returns:
an array of strings, each of which is the name of a method implemented by the server.
Author:
Vinod Kurup

Partial Call Graph (max 5 caller/called nodes):
%3 xmlrpc::list_methods xmlrpc::list_methods (public) system.listMethods system.listMethods system.listMethods->xmlrpc::list_methods

Testcases:
No testcase defined.

system.methodHelp (public)

 system.methodHelp methodName

This method takes one parameter, the name of a method implemented by the XML-RPC server.

Parameters:
methodName (required)
method implemented in XML-RPC
Returns:
a documentation string describing the use of that method. If no such string is available, an empty string is returned. The documentation string may contain HTML markup.
Author:
Vinod Kurup

Partial Call Graph (max 5 caller/called nodes):
%3 api_proc_documentation api_proc_documentation (public) system.methodHelp system.methodHelp system.methodHelp->api_proc_documentation

Testcases:
No testcase defined.

system.multicall (public)

 system.multicall array

Perform multiple requests in one call - see http://www.xmlrpc.com/discuss/msgReader$1208

Takes an array of XML-RPC calls encoded as structs of the form (in a Pythonish notation here):

    {'methodName': string, 'params': array}
    

Parameters:
array (required)
array of structs containing XML-RPC calls
Returns:
an array of responses. There will be one response for each call in the original array. The result will either be a one-item array containing the result value - this mirrors the use of <params> in <methodResponse> - or a struct of the form found inside the standard <fault> element.
Author:
Vinod Kurup

Partial Call Graph (max 5 caller/called nodes):
%3 xmlrpc::invoke_method xmlrpc::invoke_method (private) system.multicall system.multicall system.multicall->xmlrpc::invoke_method

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

# /packages/xml-rpc/tcl/system-procs.tcl
ad_library {
    Standard reserved methods
    http://xmlrpc.usefulinc.com/doc/reserved.html

    @author Vinod Kurup [vinod@kurup.com]
    @creation-date Thu Oct  9 22:14:04 2003
    @cvs-id $Id: system-procs.tcl,v 1.7 2024/10/08 15:27:42 antoniop Exp $
}

ad_proc -public system.listMethods {} {
    Enumerate the methods implemented by the XML-RPC server.

    The system.listMethods method requires no parameters.

    @return an array of strings, each of which is the name of a method
    implemented by the server.
    @author Vinod Kurup
} {
    set result [list]
    foreach proc_name [xmlrpc::list_methods] {
        lappend result [list -string $proc_name]
    }

    return [list -array $result]
}

# system.methodSignature not implemented because we don't keep track of
# parameter types or return types

d_proc -public system.methodHelp {
    methodName
} {
    This method takes one parameter, the name of a method implemented by
    the XML-RPC server.

    @param methodName method implemented in XML-RPC
    @return a documentation string describing the use of that method.
    If no such string is available, an empty string is returned. The
    documentation string may contain HTML markup.
    @author Vinod Kurup
} {
    return [list -string [api_proc_documentation $methodName]]
}

d_proc -public system.multicall {
    array
} {
    <p>
    Perform multiple requests in one call - see
    http://www.xmlrpc.com/discuss/msgReader$1208
    </p>

    <p>
    Takes an array of XML-RPC calls encoded as structs of the form (in a
    Pythonish notation here):
    <pre>
    {'methodName': string, 'params': array}
    </pre>
    </p>
    @param array  array of structs containing XML-RPC calls
    @return an array of responses. There will be one response for each call
    in the original array. The result will either be a one-item array
    containing the result value - this mirrors the use of &lt;params> in
    &lt;methodResponse> - or a struct of the form found inside the
    standard &lt;fault> element.
    @author Vinod Kurup
} {
    set responses [list]

    foreach call $array {
        # parse the call for methodName and params
        if { [catch {
            unset -nocomplain c
            array set c $call
            set method $c(methodName)
            set params $c(params)
        } errmsg ] } {
            # if we can't get a methodName and params, then fault
            lappend responses [list -struct \
                                   [list faultCode [list -int 5] \
                                        faultString "Invalid request. $errmsg"
                                   ]]
        } else {
            # call the method
            set errno [catch {xmlrpc::invoke_method $method $params} result]
            if { $errno } {
                # fault
                lappend responses [list -struct \
                                       [list faultCode [list -int $errno] \
                                            faultString $result]]
            } else {
                lappend responses $result
            }
        }
    }
    return [list -array $responses]
}

d_proc -public system.add {
    args
} {
    Simple test function.
    Add a variable number of integers.

    @param args variable number of integers
    @return integer sum
} {
    set sum 0
    foreach value $args {
        incr sum $value
    }
    return [list -int $sum]
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: