Python XML-RPC Server with clientside Javascript

paul paul at
Sat Jul 5 12:39:34 CEST 2008

akineko schrieb:
> Hello everyone,
> I have used Python SimpleXMLRPCServer to expose several methods to be
> used.
> My Python script creates a free-standing server and not a CGI script.
> I have tested its exposed methods using the following Python script:
> import xmlrpclib
> s = xmlrpclib.ServerProxy('http://localhost:8765')
> print s.my_method()
> I tested all methods one by one and they are working as I intended.
> Now, I want to use those exposed methods from a static html file
> (without any web server) using client side javascript. (i.e. Open
> File... from the browser (or file://...) )
> I found many XML-RPC examples with javascript but all of them I found
> assume XML-RPC services to be deliver from a web server, such as
> Apache, as a CGI.
I'd think this has nothing to do with CGI vs. "free-standing", the 
client couldn't tell the difference anyway.
It looks like you're running in the  "same origin" javascript security 
restriction enforced by the browser. That is, the origin of your 
javascript is file://... and you're trying to access 
http://localhost:8765. This is not allowed.


More information about the Python-list mailing list