Hello,
I am trying to use z3c.jsonrpc to write an endpoint in GroupServer (
http://groupserver.org/), an listserv/web forum hybrid built on Zope 2.
However, it seems that the JSON server is not handling application/json
requests, and I can not figure out why.
You can see the code for my attempted implementation at
https://source.iopen.net/groupserver/gs.group.member.invite.json/files/48e83035eee1a485e641a3290a295ed4d6355c58/gs/group/member/invite/json/.
Don't worry if you encounter an SSL certificate warning, that's pretty
normal.
api_rpc_test.py in particular contains the class that is my attempt to
implement a JSON-RPC endpoint. It started off as a zope.formlib form, so
there's still vestigial methods form that; invite is the only real method
of interest.
I'm able to start GroupServer with the gs.group.member.invite.json as it is
above. However, when I attempt to invoke the invite method via JSON-RPC:
curl -i -X POST -H Content-Type: application/json -H Accept:
application/json' -d '{jsonrpc: 2.0, method: invite, params:
{foo: bar}, id: 1}' http://localhost/groups/example_group/
the response I receive is the HTML I would receive from a standard request
to that address (note: /groups/example_group/ implements
gs.group.base.interfaces.IGSGroupMarker).
I've attempted to use zope.testbrowser as described at
https://pypi.python.org/pypi/z3c.jsonrpc/#testing with slight variations:
from zope.testbrowser.testing import Browser
browser = Browser()
siteURL = 'http://samus/groups/example_group'
browser.post(siteURL + '/content', {'method':'hello', 'id':1},
content_type='application/json')
The result of this is :zope.configuration.exceptions.ConfigurationError: No
registered publisher found for (POST/application/json)
api_rpc_test.py is definitely being read during the launch of GroupServer,
and the whole application is able to load. I'm also able to execute all of
the code in the section at
https://pypi.python.org/pypi/z3c.jsonrpc/#jsonrpc-proxy.
I'm not sure what else to do, nor am I entirely sure what is wrong. I'd
appreciate any help anybody can offer on this.
Thanks,
Bill
___
Zope-Dev maillist - Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )