Menu

OaXmlRpc.js

OpenAutonomy Inc.

This file is self-contained (depends on nothing else) so it is an appropriate embeddable library for XML-RPC support in JavaScript applications.

For simplicity, it only exposes one public method and its constructor takes only one argument:

// Constructor takes a string pointing to the end-point URL (note that JavaScript access
//  rules apply so the host name and port must be the same as the calling page).
function OaXmlRpc(rpcEndPointUrl)

// All calls are asynchronous, taking the method name and an argument array, along with
//  functions to handle the successful response and fault response.
this.callAsync = function(methodName, argArray, onReturn, onError)

Example usage:

var rpc = OaXmlRpc('http://example.com/script.php');
rpc.callAsync('method.test',
    new Array('arg0', 'arg1'),
    function(result)
    {
        console.log('SUCCESS');
    },
    function(errorString)
    {
        console.log('ERROR: ' + errorString);
    }
);

Direct link to source code


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.