problem with JSON-RPC
Michel Perez
opsbat at infomed.sld.cu
Wed Nov 12 09:33:41 EST 2008
Hi everybody:
I'm trying to use JSON-RPC to provide my services but produce this
exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "jsonrpc/proxy.py", line 43, in __call__
resp = loads(respdata)
File "jsonrpc/json.py", line 211, in loads
raise JSONDecodeException('Expected []{}," or Number, Null, False or
True')
jsonrpc.json.JSONDecodeException: Expected []{}," or Number, Null, False
or True
This is what am doing
==== configuration file for apache ====
<code lang="apache.conf">
Alias /services/ //home/mperez/Desktop/test_jsonrpc/
<Location /services/>
Options Indexes MultiViews FollowSymLinks
Order deny,allow
Allow from All
AddHandler mod_python .py
PythonHandler jsonrpc
</Location>
</code>
==== service for jsonrpc test.py ====
<code lang="python">
from jsonrpc import ServiceMethod
class MyService(object):
@ServiceMethod
def echo(self, msg):
return msg
service = MyService()
</code>
==== service client ====
<code lang="python">
#!/usr/bin/env python
from jsonrpc import ServiceProxy
s = ServiceProxy("http://localhost/services/test.py")
print s.echo("foobar")
</code>
Regards
--
Michel Perez )\._.,--....,'``.
Ulrico Software Group /, _.. \ _\ ;`._ ,.
Nihil est tam arduo et difficile human `._.-(,_..'--(,_..'`-.;.'
mens vincat. Séneca. =============================
---------------------------------------
Red Telematica de Salud - Cuba
CNICM - Infomed
More information about the Python-list
mailing list