xmlrpc::invoke (private)

 xmlrpc::invoke xml

Defined in packages/xml-rpc/tcl/xml-rpc-procs.tcl

Take the XML-RPC request and invoke the method on the server. The methodName element contains the Tcl procedure to evaluate. The method is called from the global stack level.

Parameters:
xml - XML-RPC data from the client
Returns:
result encoded in XML and ready for return to the client

Partial Call Graph (max 5 caller/called nodes):
%3 packages/xml-rpc/www/index.tcl packages/xml-rpc/ www/index.tcl xmlrpc::invoke xmlrpc::invoke packages/xml-rpc/www/index.tcl->xmlrpc::invoke xml_doc_free xml_doc_free (public) xmlrpc::invoke->xml_doc_free xml_doc_get_first_node xml_doc_get_first_node (public) xmlrpc::invoke->xml_doc_get_first_node xml_node_get_children_by_name xml_node_get_children_by_name (public) xmlrpc::invoke->xml_node_get_children_by_name xml_node_get_content xml_node_get_content (public) xmlrpc::invoke->xml_node_get_content xml_node_get_first_child xml_node_get_first_child (public) xmlrpc::invoke->xml_node_get_first_child

Testcases:
No testcase defined.
Source code:
    # check that the XML-RPC Server is enabled
    if { ![xmlrpc::enabled_p] } {
        set result [xmlrpc::fault 3 "XML-RPC Server disabled"]
        ns_log error "xmlrpc::invoke fault $result"
        return $result
    }

    # check that the provided XML is non-empty
    if { $xml eq "" } {
        set result [xmlrpc::fault 3 "Empty XML document passed to XML-RPC"]
        ns_log error "xmlrpc::invoke fault $result"
        return $result
    }

    ns_log debug "xmlrpc::invoke REQUEST: $xml"
    if {[catch {set doc [xml_parse -persist $xml]} err_msg]} {
        set result [xmlrpc::fault 1 "error parsing request: $err_msg"]
        ns_log error "xmlrpc::invoke: error parsing request: $err_msg"
    } else {
        # parse OK - get data
        set data [xml_doc_get_first_node $doc]

        set method_name  [xml_node_get_content  [lindex  [xml_node_get_children_by_name $data methodName] 0 ]]

        set arguments [list]
        set params [xml_node_get_children_by_name $data params]
        if {$params ne ""} {
            foreach parameter [xml_node_get_children_by_name $params param] {
                lappend arguments  [xmlrpc::decode_value [xml_node_get_first_child $parameter]]
            }
        }

        set errno [catch {xmlrpc::invoke_method $method_name $arguments} result]
        if { $errno } {
            set result [xmlrpc::fault $errno $result]
            global errorInfo
            ns_log error "xmlrpc_invoke: error in xmlrpc method REQUEST: $xml RESULT: $result\n$errorInfo"
        } else {
            # success
            set result [xmlrpc::respond $result]
            ns_log debug "xmlrpc::invoke result $result"
        }
    }
    if {[info exists doc]} {
        xml_doc_free $doc
    }

    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: