# # JSON-RPC demo client contributed by Christoph Zwerschke # try: import simplejson except ImportError: simplejson = None from ExamplePage import ExamplePage class JSONRPCClient(ExamplePage): """Demo client for using the JSON-RPC example.""" def writeJavaScript(self): ExamplePage.writeJavaScript(self) if not simplejson: return self.write('''\ ''') def writeContent(self): self.write('''\
This example shows how you can call methods of a JSON-RPC servlet built with Webware for Python from your web browser via JavaScript (which has to be activated to run this demo).
The example uses a JSON-RPC JavaScript client based on Jan-Klaas' "JavaScript o lait" library (jsolait). You can also use other JavaScript libraries and toolkits such as dojo or pyjamas for that purpose.
In order to run the JSON-RPC servlet, simplejson must be installed on your server.''') if not simplejson: self.write(''' Unfortunately, simplejson is not installed.''') return self.write('''
Type in any example text to be used as input parameter, choose one of the available methods to be invoked by the example servlet and press the button to display the result.
| Input parameter | Remote method | Result |
|---|---|---|