XmlRpc.js

xml-rpc.js is a JavaScript library I created to make it easy to connect a web interface to Python applications that may not have been written with the web in mind. It allows JavaScript running in your web browser to seamlessly execute functions running inside atraditionalPython application and receive results.

Based on the Mimic JS library oringinally written by Carlos Eduardo Goncalves; see below for license.

  • Provides an easy to use object-oriented interface for XML-RPC.
  • Transparently converts objects to JS literals were practical (e.g. String(‘abc’) -> ‘abc’).
  • Allows using XML-RPC with servers on different domains and/or ports than the originating web server.

Limitations

At this stage, the library relies on syncronous AJAX calls to allow completely transparent method invocation. In the future, the library will support ES6 async/await.

Examples

Initializing a connection

var rpc = new XmlRpcConnection({
    url:    "http://<some_url>",    // URL to XML-RPC service
    log:    true,                   // If true, logs all requests to console
    record: false                   // If true, records all requests and results to rpc._requests
});

All options are optional aside from the url.

Invoking a remote method.

rpc.method_name('param1', 'param2', 'etc');

All the error handling is taken care of but if you like you can catch{} it. In addition, methods that fail return undefined.

Original License

Mimic (XML-RPC Client for JavaScript) v2.0.1 Copyright © 2005-2009 Carlos Eduardo Goncalves (cadu.goncalves@gmail.com)

Mimic is dual licensed under the MIT (http://opensource.org/licenses/mit-license.php) and GPLv3 (http://opensource.org/licenses/gpl-3.0.html) licenses.